Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request scope for 3-4 pages

 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Suchak Jani
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64837
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic