• 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

passing form accross action resets the properties

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
a jsp Person.jsp, a form PersonForm.class 2 actions PersonDisplay.class and PersonProcess.class mapped to the same form.
struts-config:
<form-bean name="testForm" type="pak.PersonForm" />
<action name="testForm" path="/PersonDisplay" scope="request" type="pak.PersonDisplayAction" validate="false">
<forward name="success" path="Person.jsp" />
</action>
<action name="testForm" path="/PersonProcess" input="/PersonDisplay.do" scope="request" type="pak.PersonDisplayAction" validate="true">
<forward name="display" path="/PersonDisplay.do" />
</action>

The request first hits the /PersonDisplay and renders the Person.jsp with a populated form, when submitted it comes to /PersonProcess action which modifies some values in the form and sends it back to /PersonDisplay if required.

problems:
1. what ever is displayed on the JSP with a <bean:write> from the form bean properties are not carried to /PersonProcess in the form bean. How to handle this problem. The bean needs to be in request scope. Can I carry forward the content of the form bean without making the scope session as this would mess with other request to the /PersonDisplay in the same session.

2. I modify some property in the form bean inside /PersonProcess before pasing to the /PersonDisplay but before reaching /PersonDisplay struts resets the form and re-populates the form bean with request parameters overwriting all modifications done in process. How to get rid of this automatic repopulation while forwarding it from another action.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does DisplayPersonAction actually do anything other than return the success forward? I assume you could avoid using this Action altogether.
 
alok paul
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I can not get rid of the /DisplayPersonAction as it initialize the form and populates the dropdown etc.
[ March 24, 2005: Message edited by: alok paul ]
reply
    Bookmark Topic Watch Topic
  • New Topic