• 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

1 Form 2 Actions both cant be request?

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have two actions that share the same form, and both actions serve to populate this form (it is a map backed form). However, if i set both of them with the scope being request, then only the second action will prepopulate the form. If i set the second action to request and leave the the first one unspecified (session?) then they both prepopulate just fine. Each form prepoluates and forwards to a different jsp. Is there a reason by the prepopulating does not take place if both actions are request scoped?

Shane
 
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
Are these two populating-actions chained together or are either of them chained together with a submitting-action that also uses the same ActionForm?
 
Sheriff
Posts: 17644
300
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Shane Johnson:
... if i set both of them with the scope being request, then only the second action will prepopulate the form. If i set the second action to request and leave the the first one unspecified (session?) then they both prepopulate just fine. ... Is there a reason by the prepopulating does not take place if both actions are request scoped?



Be default, the form will be in the request scope; specifying request scope explicitly should not make a difference. Not sure why it is in your case. Is there any other difference in the configuration?

EDIT: (correction, see Marc's post below), the framework default scope is session.
[ January 21, 2005: Message edited by: Junilu Lacar ]
 
Shane Johnson
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
here is are three of the actions:

<action path="/someAction"
type="my.company.someactionclass"
name="someform" scope="request" validate="false">
<forward name="success" path="/actionA.do" />
</action>

<action path="/actionA"
type="my.company.actionclassA"
name="theform" validate="false">
<forward name="success" path="jspA" />
</action>

<action path="/actionB"
type="my.company.actionclassB"
name="theform" scope="request" validate="false">
<forward name="success" path="jspB" />
</action>

we start with someAction that gets a form and basically saves the data. lets say we were on a page that asked for a persons info and when we submitted we save that person. that action then calls actionA which will load a map backed form with some data we need to show on jspA. there is a link on jspA that will perform actionB that will then show us some different data on jspB.

what you see above works just fine. if we add the phrase 'scope="request"' in the definition for actionA then actionA does prepopulate anymore. if i remove this phrase from actionB then actionB does not prepopulate anymore.

i hope clarified your above comments.

shane
 
Marc Peabody
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
Read section 4.3 - this says that session is the default scope.
The source code also shows the logic of "if request is specified, set to request else set to session". Finally, the default value in the ActionConfig class is:
protected String scope = "session";

Anyway, it's hard to say from the surface what could be causing the issues. I do admire your patience for how many times you've probably restarted your server on each tweak of the struts-config file.

There has got to be something deeper causing the problem.
It seems weird that you are using a map-backed form to display information about a single student.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic