M
Mariano
The title is really reductive, i'll try to explain it better. Then I
use JSP to create dinamically an XML document, something like an SQL
query, and printing of DB result in an XML form. I have a JS too, that
realize XMLHttpRequest(), and information are read from that XML
document (JSP file). There are many JS function that could use the
same XML document, so everytime JSP file are called, SQL query
executed and XML document used, it can be usefull for DB load cause
SQL query is really simple, and all results filtering are realized in
Javascript with XPath. Now, the question is:
what can i do if I wanna have a DB load lighter than before???. For
example: I call a Javascript function that use the users.jsp XML
document, so JSP will create XML and JS will do some operations on
that information, now, if there is a second Javascript function, that
will use the same user.jsp XML document it will force JSP file to run
a new query on DB, but result of query (and relative XML document)
will be the same than before. What can i do to avoid the execution of
SQL query when it will return the same result of the last query
This is an example of my JSP file/XML Document.
<%@ page contentType="text/xml" pageEncoding="windows-1252"%>
<%@ page language="java" import="java.sql.*"%>
<%
Connection dbconn = null;
Class.forName("com.mysql.jdbc.Driver");
dbconn = DriverManager.getConnection("", "", "");
Statement stmt = dbconn.createStatement();
String query = "SELECT ...";
query += "FROM ...";
ResultSet rs = stmt.executeQuery(query);
%>
<radice>
<%
while (rs.next()) {
out.println("<tag>"+rs.getString("data")+"</tag>");
}
%>
</radice>.
Hope, that I've correctly explained my problem.
use JSP to create dinamically an XML document, something like an SQL
query, and printing of DB result in an XML form. I have a JS too, that
realize XMLHttpRequest(), and information are read from that XML
document (JSP file). There are many JS function that could use the
same XML document, so everytime JSP file are called, SQL query
executed and XML document used, it can be usefull for DB load cause
SQL query is really simple, and all results filtering are realized in
Javascript with XPath. Now, the question is:
what can i do if I wanna have a DB load lighter than before???. For
example: I call a Javascript function that use the users.jsp XML
document, so JSP will create XML and JS will do some operations on
that information, now, if there is a second Javascript function, that
will use the same user.jsp XML document it will force JSP file to run
a new query on DB, but result of query (and relative XML document)
will be the same than before. What can i do to avoid the execution of
SQL query when it will return the same result of the last query
This is an example of my JSP file/XML Document.
<%@ page contentType="text/xml" pageEncoding="windows-1252"%>
<%@ page language="java" import="java.sql.*"%>
<%
Connection dbconn = null;
Class.forName("com.mysql.jdbc.Driver");
dbconn = DriverManager.getConnection("", "", "");
Statement stmt = dbconn.createStatement();
String query = "SELECT ...";
query += "FROM ...";
ResultSet rs = stmt.executeQuery(query);
%>
<radice>
<%
while (rs.next()) {
out.println("<tag>"+rs.getString("data")+"</tag>");
}
%>
</radice>.
Hope, that I've correctly explained my problem.