There is a situation, I want to display few rows from the database table on to my JSP page while the JSP page is getting loaded. I want this to happen throught a servlet, which I am using as a controller. How to accomplish this without actually submitting the JSP page.
Put the following code into your JSP:
<% out.flush() %>
That will transmit all the output generated by your JSP up to that point to your client. Be warned; you can get some flakey behavior with this. Some potential problems:
1. Once you have flushed some output, the engine can no longer perform redirections, which can mess up error reporting if an error occurs later in the page.
2. If your output is part of an HTML table, the browser may do funny things rendering partial tables.
Look at this article in Oreilly network. It might be related to what you are trying to do