Team, Can i use request scope for 3-4 pages. From the servlet i can use the requestdispatcher when it goes to a jsp. The problem is that i have links from hrefs and forms going to my servlets in my JSP's.The question is how do i di this form a JSP. Regards Suchak Jani
I don't really understand the entirety of what you are asking, but request scope exists for a single request. And since a request can result in just one response -- hence one page -- there is no way to make it persist across multiple pages. For data to persist across pages, you either need to store it in the session or use some other server-side persistance mechansism. bear
Requestdisparher interface can void forward(ServletRequest request, ServletResponse response) Forwards a request from a servlet to another resource (servlet, JSP file, or HTML file) on the server. void include(ServletRequest request, ServletResponse response) Includes the content of a resource (servlet, JSP page, HTML file) in the response.
RequestDispatcher.forward() is irrelevant in this case. While you can forward a request to another resource, you still can't make it persists across multiple pages since each request must result in a single response, and each page requires its own response. bear