I have a JSP page that I retrieve with A开发者_C百科JAX. The JSP page has embedded queries that are executed and then rendered as tables. Each execute/render displays the first 100 results.
Is there a way to pass parameters to the queries in the JSP page as a part of my AJAX call? Say, for example, if I wanted to query the database again with a different SQL for the next 100 results?
Thanks.
How are you calling the page with ajax? Like this: http://www.mypage.jsp
Then you could use a querystring -- like this: http://www.mypage.jsp?name=John+Smith
And then in your jsp page, you could have a function like this:
<%
if (request.getParameter("name") == null) {
out.println("Oops -- no data found.");
} else {
out.println("Howdy <b>"+request.getParameter(i)+"</b>!");
}
%>
精彩评论