also.. you're RIGHT!!! It's not working in other places either!!!
 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. :(

 On 5/6/05, David Johnson <[EMAIL PROTECTED]> wrote: 
> 
> ahhhh I see. Soam I adding scrope="session" to the Form Bean or the Action 
> Mapping? 
> 
> On 5/6/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote:  
> > 
> > > I do have redirect="true" set on the actionMapping that brings me to 
> > this
> > > page, and tthe browser should be caching field values. 
> > >
> > > the weird thing is this works in other places
> > 
> > If you want to keep redirect="true" (I personally prefer redirects for
> > better user experience), then you may want to set scope="session" for 
> > your form.
> > 
> > This should not work in other places. Maybe your other forms have
> > session scope or somehow browser thinks that it can cache those pages?
> > 
> > > > You need to include hidden files for any static text properties. 
> > > >
> > > > Typically I have <bean:write name="form" property="property"
> > > > /><html:hidden name="form" property="property" />
> > > >
> > > > NOTE: this should not be done for input fields 
> > > >
> > > > <html:text name="form" property="property" /> <!-- do not include a 
> > hidden
> > > > field for this property -->
> > > >
> > > I actually am for one of the properties. 
> > > In the page I have :
> > > <html-el:hidden property="queryName" value="${queryName}"/>
> > > and in the Action Class (right before the reditrct to this page)
> > > request.setAttribute ("queryName",queryName);
> > > and it shows fine in view--> source.
> > > thn if I submit the form (wiuth an error) the hidden field is **not**
> > > populated
> > 
> > It will not be populated. You redirect to the page, that is, you 
> > reload the page from the server using empty GET request with no query
> > parameters. Struts cannot populate your form bean since there is no
> > input data. So it just shows you JSP using current form field values.
> > If your form has request scope, it is recreated for each request, so
> > there are no values in it.
> > 
> > Do not use hidden fields. You started well using redirection to the
> > View ;-) Just change scope of your form to "session", and it will 
> > retain values for you. But now you would have to clean unneeded values
> > in the reset() method. It is a bit of a hassle, but it works better
> > for an end user, and you do not need to pass viewstate in hidden HTML
> > fields.
> > 
> > Maybe you will find this useful:
> > http://wiki.apache.org/struts/StrutsCatalogRedirectToInputPage
> > http://wiki.apache.org/struts/StrutsMultipleActionForms
> > 
> > Michael.
> > 
> 
> 
> 
> -- 
> -Dave
> [EMAIL PROTECTED] 




-- 
-Dave
[EMAIL PROTECTED]

Reply via email to