• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting and sending variables

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to keep the 3 Tier architecture. I'd like to have a JSP page for presentation with a value. I then pass the value of that variable to the servlet using the request.getParameter method. I perform some operations with the variable. Now when I redirect from my servlet to a new JSP, how can I get the value of that variable?
 
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Whenever u pass a form fiels as a part of request its just for the request. You can get it only in the servlet. When you invoke another jsp or servlet from it.. the values are no more part of the request.
There are two ways to get the values on the next page also..
1. put it in the session. But one should be very careful about putting anything in to session. because if the session gets too heavy it hampers the performance of the application.
2. another way is that when invoking a jsp/servlet from the servlet put the value as a hidden field or as a wuery string.
hope it helps..
-kaustubh.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chris, instead of redirecting, you can use the forward method of the requestDispatcher. In this case the rquest object is available to the JSP.
reply
    Bookmark Topic Watch Topic
  • New Topic