Two Laptop Bag*
The moose likes JSP and the fly likes request scope for 3-4 pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "request scope for 3-4 pages" Watch "request scope for 3-4 pages" New topic
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: 60781
    
  65

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by 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: 60781
    
  65

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
 
Consider Paul's rocket mass heater.
 
subject: request scope for 3-4 pages
 
Similar Threads
jsp session scope List values
JSP page object
question about page scope
problem while keeping scope as session
include directive confusion