I've a requirement, where I fetch data from table, display the info on jsp. On the first jsp, I should display only basic info and provide a link (against each row) to other jsp where complete info of that particular record is displayed. So, when I query the database, I have the complete info and it is returned to jsp. Now, how can I avail this info to next jsp.
Below is the piece of code where I iterate over the result set..
I want to pass the result object from my current jsp to next jsp.
Below is my complete jsp.
Using that id your servlet can call your database service code to retrieve the correct instance, which can then be added to the request before it is forwarded to the JSP page.
Thank you for the response. I don't want to make a second db call. That is why, I got the entire result in the first request and got the response. Now, I have the complete response, but I need to pass the response (in my case, result object) to 2nd jsp.
santosh batta wrote:... I don't want to make a second db call. That is why, I got the entire result in the first request and got the response. Now, I have the complete response, but I need to pass the response...
santosh batta wrote: I'm very new to the front end development and client side scripting.
If you are new to front-end development then you should take the advice of people that have been doing this for a long time. The correct approach is to not fetch any data you don't need on the first request, and to follow the advice to fetch the info from the database on the second request.
Trying to front-end cache the data between requests is a kludge at best, and fraught with possible problems.
If you are worried about the extra DB call, you are likely succumbing to premature optimization which is a very bad thing to give in to.