<%@page contentType="text/html"%><%@page pageEncoding="UTF-8"%><%@include file="TreeGridFramework.jsp"%><%
/*-----------------------------------------------------------------------------------------------------------------
Sample JSP web page, using java.sql.ResultSet object to read and write TreeGrid data from and to database.
By default, connection string is ODBC to MS Access db in ../Data/CalcData.mdf.
Shows sending data by page submit to server in hidden input.
Form is submitted by TreeGrid Save button or by external submit button.
------------------------------------------------------------------------------------------------------------------*/

//------------------------------------------------------------------------------------------------------------------
response.addHeader("Cache-Control","max-age=1, must-revalidate");

// --- Database connection ---
java.sql.Statement Cmd = getHsqlStatement(request,out,"Database","sa","",true);

// --- Save data to database ---
saveTree(request.getParameter("TGOutput"),Cmd,"TreeData","ID","Parent","#Body");

// --- Load data from database ---
String[] Names = {"A","C","D","E","G","H","I","id","Parent","Pos","Def"};
String Str = toHTMLString(getTreeXML(Cmd,"TreeData",Names,"#Body","#Head","#Foot",true));
//------------------------------------------------------------------------------------------------------------------
%><html>
   <head>
      <link id="GridCSS" href="../../Grid/Grid.css" title="GridStyle" type="text/css" rel="stylesheet">
      <script src="../../Grid/GridE.js"> </script>
   </head>
   <body>
      <div style="WIDTH:100%;HEIGHT:90%">
         <bdo 
				Layout_Url="TreeDef.xml" 
				Data_Tag="TGInput" 
				Upload_Tag="TGOutput" Upload_Format="Internal"
				Export_Url="Export.jsp" Export_Data="TGData" Export_Param_File="SubmitTree.xls"
				></bdo>
      </div>
      <form method="post">
         <input name="TGInput" type="hidden" value="<%=Str%>">
         <input name="TGOutput" type="hidden">
         <input type="submit" value="Submit changes to server"/>
      </form>
   </body>
</html>
