• 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

Pass a Variable from JSP via JSP to an Action Servlet

 
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using the Struts framework.

I have the value of a variable defined in JSP#1 (JSP#1 is not a form):

All the variables, which are defined in JSP#1, are forwarded to JSP#2.

JSP#2 is a form. But, the variable 'id' is not used in JSP#2.

JSP#2 has a submit button and then, an action servlet takes over the control. All the text fields in JSP#2 together with the variable 'id' are forwarded to this action servlet.

I have two questions:

1. I should put this variable 'id' in the request scope or the session scope. Currently, it is in the session scope.

2. How to retrieve the value of this variable 'id' in the action servlet? (I do not want to print the value out. I want to retrieve the value and store it in a database.)

session.getAttribute( "id" ); // returns an object. 'id' should be an integer
[ July 01, 2004: Message edited by: JiaPei Jen ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic