• 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

Help me with session tracking example

 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two html pages and I have the submit button in second page.
I have to save the data of the first page when the user navigates to the
second one. This can be done using Session tracking.
What I know is u can start of saying
HttpSession ses = request.getSession(true);
I am not sure how I will save the value in the fields of the first form.
Should I create String variables to save the data. If that is the case
I need not create a session object. What I will do is I will place a button called "continue" in my first html and check. If it is equal to
"continue" I will save it in String variables and if it is "submit" then I will try to do the reqd manipulation.

I am really sought of breaking my head about how to use session object to
save my data in first page. can anyone help me with a example code.
Just give me an example using two fields in first page and two fields
along with submit button in second page.
Please... I need ur help.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A simple approach - assuming your servlet or JSP writes the second page, is to just re-write those first page form values into the second page form as type="hidden" variables, that way when you process the second page all variables will be there.
Your servlet can tell if it is getting a response from the first or second page with the same technique.
<input type="hidden" name="page" value="first" >
Sessions would also work but this is simpler and works no matter how the browser is set up.
WBB
 
reply
    Bookmark Topic Watch Topic
  • New Topic