Hi,
i am new to Dhtmlx and i am using it with jsp.
i need to display data from the database into the grid, and also want to perform delete and add operations that should reflect on to database
my display is working perfectly but when i perform the delete operation it gives me a message incorrect xml?
hear is my code?
xml.jsp
<%
response.setContentType(“text/xml”);
out.println(“<?xml version=\"1.0\" encoding=\"UTF-8\"?>”);
%>
<%@ page import = “java.sql.*” %>
<%
// define variables from incoming Table values
String posStart = “”;
if (request.getParameter(“posStart”) != null){
posStart = request.getParameter(“posStart”);
}else{
posStart = “0”;
}
String count = “”;
if (request.getParameter(“count”) != null){
count = request.getParameter(“count”);
}else{
count = “100”;
}
// connect to database
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
String connectionURL = “jdbc:h2:~/test”;
Class.forName(“org.h2.Driver”).newInstance();
connection = DriverManager.getConnection(“jdbc:h2:~/test”, “sa”, “”);
// query to table
String sql = “SELECT * FROM test”;
String totalCount = “”;
if (posStart.equals(“0”)){
String sqlCount = “Select count(*) as cnt from (” + sql + “) as tbl”;
statement = connection.createStatement();
rs = statement.executeQuery(sqlCount);
rs.next();
totalCount = rs.getString(“cnt”);
rs.close();
} else {
totalCount = “”;
}
// add limits to query to get only rows necessary for output
sql += " LIMIT " + posStart + “,” + count;
// Execute the query
statement = connection.createStatement();
rs = statement.executeQuery(sql);
// output data in XML format to retrive from DB(test)
out.println(“”);
while (rs.next()) {
out.println(“”);
out.println(“”);
out.println(rs.getString(“ID”)); // value for product name
out.println(“”);
out.println(“”);
out.println(rs.getString(“NAME”)); // value for internal code
out.println(“”);
out.println(“”);
}
out.write(“”);
rs.close();
%>
and design file
Insert title here<script src="codebase/dhtmlx.js" type="text/javascript"></script>
<style>
/*these styles allow dhtmlxLayout to work in fullscreen mode in different browsers correctly*/
html, body {
width: 100%;
height: 100%;
margin: 0px;
overflow: hidden;
background-color:white;
}
</style>
<div id="box" style="width:350px; height:160px; background-color:white;"></div>
<div id="box2" style="width:350px; height:100px; background-color:white;"></div>
could any one give me a sample code to perform CRUD operations in DHTMLXGRID in jsp…