• 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

Struts Action Form

 
Ranch Hand
Posts: 180
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I have a general question about the action forms.

Suppose i have an action which builds up a form by setting its properties and then it forwards the control to a JSP which uses the same form.
But i have kept the form in the request scope.

So would i be able to retrieve the set values from the action class.?

Please help

Saurav
 
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Yeah you can access the form properties in your jsp. You have to declare the variables inside the html form(the form name needs to be the same as action form name) which you declare in the jsp. you can keep them hidden or display them as per your needs by using corresponding html tags.
Ketan.
 
Ranch Hand
Posts: 948
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you asking if when you submit the JSP will the form that is passed to the action have all the values that where there when the JSP was rendered? If you are asking that then the answer is no. A brand new instance of the form will be created and it will only be populated with values that are submitted from the JSP. This will only include values in input tags (including hidden input tags).

If you are asking if you can get the values from the form in your JSP then Ketan's answer is correct. Yes you can read values from the form to populate your page. This is very common and I much prefer placing values on the form over placing values directly on the request.

- Brent
 
saurav sarkar
Ranch Hand
Posts: 180
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ketan and Brent for your replies.
yes i am asking the second option Brent, i thought it too
but to my surprise i am not able to retrieve the values
in the JSP.But if i keep the form scope to session i am
able to get.
 
reply
    Bookmark Topic Watch Topic
  • New Topic