dcsimg
<jsp:forward> or response.sendRedirect()
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Lior_Shliechkorn
Posted On:   Friday, September 13, 2002 08:05 AM

Hi, I'm new to the JSP world and was just wondering which is a better method to use when redirecting the user across a page. I'm trying to use a connection pool and there are certain conditions that are checked in the database which send the user to another page at certain points in the page. Now, I want to release a connection before sending the user to another page and close all statements and resultsets before doing so as well. Is this a good system? Should I just redirect the user to another page, or just release the connection and then when the page comes back to the "forwarder" let it go to the finally block and close the statements etc. Thanks.    More>>

Hi,



I'm new to the JSP world and was just wondering which is a better method to use when redirecting the user across a page. I'm trying to use a connection pool and there are certain conditions that are checked in the database which send the user to another page at certain points in the page.


Now, I want to release a connection before sending the user to another page and close all statements and resultsets before doing so as well. Is this a good system? Should I just redirect the user to another page, or just release the connection and then when the page comes back to the "forwarder" let it go to the finally block and close the statements etc.



Thanks.

   <<Less

Re: &lt;jsp:forward&gt; or response.sendRedirect()

Posted By:   Lasse_Koskela  
Posted On:   Friday, September 13, 2002 09:04 AM

You should always close/release any pooled resources you're using as soon as you don't have the immediate need for them.


In this case, I think you should close the database connection (and statements/resultsets) right after you get the info you're looking for. Then perform a forward using


getServletContext().getRequestDispatcher("/path/to/next.jsp").forward(request, response);
About | Sitemap | Contact