| Author |
request scope for 3-4 pages
|
Suchak Jani
Ranch Hand
Joined: Jan 24, 2002
Posts: 68
|
|
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
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56201
|
|
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
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Suchak Jani
Ranch Hand
Joined: Jan 24, 2002
Posts: 68
|
|
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.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56201
|
|
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
|
 |
 |
|
|
subject: request scope for 3-4 pages
|
|
|