Right. What I want is to pre-populate text fields if the user id "editing" 
or set it to "" if the user is creating a new thing.
 I think what I'll settle on is making the "portfolioName" request attribute 
a session attribute instead, then in the Save() methos, execute a 
myForm.reset()
 Is that fairly typical? Is there a better way to achive my goal of 
prepopulating fields that exist? I guess I assumed that they'd be populated 
but be linked to the form bean assigned to the form.
 Sigh.
 I feel like there's just a small bit of understanding I'l lacking here....

 On 5/6/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: 
> 
> Umm... This one <html:text property= "userName" /> pulls data from
> userName property of a form bean. So if the form bean has session
> scope, the value will be retained..
> 
> This one <html-el:text property= "portfolioName"
> value="${portfolioName}"/> pulls value from portfolioName, you need to
> check where this object is stored, in what scope. You are right, if
> this object has request or page scope, then it will be wiped out after
> redirect.
> 
> Michael.
> 
> On 5/6/05, David Johnson <[EMAIL PROTECTED]> wrote:
> > Hmm
> >
> > I'm now officially confused (and on a Friday no less). I've set the
> > scope="session" but when I get back from the validate() my values are 
> STILL
> > gone
> >
> > Also, a separate question, how is what we're talking about different 
> from my
> > login screen where if the user puts a userID in but no password, they 
> get a
> > validate() error , but the userID is populated with whatever they'd
> > previously typed.
> >
> > the one difference I see is that I'm namually populating fields in the 
> non
> > working form.
> >
> > So, this does NOT work unpopulated after validate():
> > <html-el:text property= "portfolioName" value="${portfolioName}"/>
> >
> > this DOES work (populated after validate()
> > <html:text property= "userName" />
> >
> > am I stupidly OVERRIDING struts' behavior? I know there's a simple 
> solution
> > to this....
> >
> >
> > On 5/6/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote:
> > > This is how Spring's RedirectView (or ViewRedirect? whatever) works.
> > > They have notion of "model" which is usually a Map. You stuff your
> > > data in it, and it is appended automatically as a payload to
> > > redirected request. Struts does not do this.
> > >
> > > If you had Struts appending all form data to the redirected request,
> > > your would be able to use the page only within a strict sequence of
> > > requests. If you jumped out from the page and browse somewhere else,
> > > you lose request data. If then you navigate to your page through
> > > browser navigation bar, you would see that you form is empty (at best.
> > > At worst, you get validation error).
> > >
> > > Spring transfers viewstate in the request, just like 
> > > ASP.NET<http://ASP.NET>. 
> I do not
> > > think this is a good idea.
> > >
> > > I think that it is much more flexible to pass ID of an object that you
> > > want to display, in the redirected request. Then your output action
> > > would load this object from the database (better from the RAM cache)
> > > and display it. Thus, the action would not care how it was called:
> > > directly, indirectly or through redirect. It just receives object ID
> > > in the request, loads object, fills out the form, and shows JSP.
> > > Pretty straightforward.
> > >
> > > Or, instead of fiddling with redirection request, just set
> > > scope="session" in your <action> element in struts-config.xml. Then
> > > form bean will retain all values for you.
> > >
> > > On 5/6/05, David Johnson <[EMAIL PROTECTED]> wrote:
> > > > here's a question. The way I thought it would work is that under the
> > covers
> > > > and before redirecting BACK to the page (assuming validate() fails) 
> I
> > > > thought it would take all the form attributes and put them back on 
> the
> > > > request to provide all the same data the original page was provided
> > with....
> > > >
> > > > but I'm seeing that's not the case. :(
> > >
> >
> >
> >
> > --
> > -Dave
> > [EMAIL PROTECTED]
> 



-- 
-Dave
[EMAIL PROTECTED]

Reply via email to