Hello Greg, I had tried to apply the instructions on the web page you sent me, but as explained in my mail, it did not work. I must have done something wrong.
One of the symptoms of an "odd" behavior is that I'm taken back to the jsp page with the form (index.jsp) when I forget to fill in something in the search text field, but that the url still shows the target action of the form and ... the rich controls are not repopulated. Guy -----Oorspronkelijk bericht----- Van: Greg Lindholm [mailto:greg.lindh...@gmail.com] Verzonden: vrijdag 16 juli 2010 19:38 Aan: Struts Users Mailing List Onderwerp: Re: Repopulating rich controls From the Struts 2 FAQ http://struts.apache.org/2.1.8.1/docs/how-do-we-repopulate-controls-when-validation-fails.html On Fri, Jul 16, 2010 at 4:40 AM, Guy Thomas <guy.tho...@vlaamsbrabant.be> wrote: > In a form I use the struts2 action tag to populate a drop down list: > > <s:actionerror /> > > <s:form action="bookactiondispatcher" namespace="/" theme="simple"> > <table> > <tr> > <td>Select an action:</td> > <td><s:action name="bookactions" namespace="/" > executeResult="true" /></td> > </tr> > > <tr> > <td>Specify search terms:</td> > <td><s:textfield name="searchString" size="44" > required="true" /></td> > </tr> > > <tr> > <td><s:submit type="input" value="Voer actie uit" > /></td> > </tr> > </table> > </s:form> > > > The "bookactions" action refers to the following jsp (bookactions.jsp): > > <%@ taglib prefix="s" uri="/struts-tags"%> <s:radio list="bookActions" > value="defaultBookAction" name="bookAction" > onclick="setTextFieldVisibility (this.value)" theme="simple" /> > > As long as I select the select action (there is also an index action) and > enter search terms, there is no problem; the user is taken to the search > result page. > > However, the code for the bookactiondispatcher action contains a validate > method: > > @Override > public void validate () > { > logger.debug ("Validating an action dispatch ..."); > > if (bookAction.equals (SEARCH) && (searchString == null || > searchString.equals (""))) > addActionError (getText > ("bookindexer.error.search.nosearchstring")); > } > > When the user selects the search action and forgets to specify search terms, > he/she is taken back to the page with the form: > > <action name="bookactiondispatcher" > class="be.vlaamsbrabant.bookindexer.actions.BookActionDispatcher"> > ... > <result name="input">/index.jsp</result> > ... > > However: > - On the "input result" page the rich control for the possible book actions > is no longer filled up. > - I "see" the contents of index.jsp (with the form), but the URL is > http://.../bookindexer/bookactiondispatcher.action (the url for the > form action.) > > I had exactly the same problem in another application. There I removed the > validate method and used a specific error result to redirect the user to an > error page. > > How I can still use struts2 validation and have my rich controls > (re-)populated when being redirected through an input result? > > > > ------------- > Aan dit bericht kunnen geen rechten worden ontleend. Alle berichten naar dit > professioneel e-mailadres kunnen door de werkgever gelezen worden. > Ondernemingsnummer: 0253.973.219 > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org ------------- Aan dit bericht kunnen geen rechten worden ontleend. Alle berichten naar dit professioneel e-mailadres kunnen door de werkgever gelezen worden. Ondernemingsnummer: 0253.973.219 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org