My SearchAction is pretty dumb. Here is my execute method. However, this forwards to my search.jsp which submits to SearchResultsAction...is this the right way to do it? Essentially I the result of an Action to Submit to another Action, etc.
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { // default target to success String target = "success"; ArrayList strainTypes = getStrainTypes(request); // set the target to failure if we could not retrieve the strain types if (strainTypes == null) { target = "error"; } else { // put all the servers in the request request.setAttribute("strainTypes", strainTypes); } // forward to the appropriate View return (mapping.findForward(target)); } -----Original Message----- From: Hubert Rabago [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 21, 2004 12:36 PM To: Struts Users Mailing List Subject: RE: Struts, Search Page, Help!!! Your input points to search.do/SearchAction. It's possible that SearchAction is resetting the values of the form. Does it know when to leave the form values alone because it's only being called due to a redisplay of a poppulated input form? --- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote: > I tried, but it didn't work. Anyway, I used the Apache LabelValueBean to > store instead of a String and got it to work: > > <html-el:select property="strainType"> > <html-el:options collection="strainTypes" property="value" > labelProperty="label"/> > </html-el:select> > > However, if I select a value, press submit, and there is an error...the > selected value is not "saved" and pre-selected. Actually, none of the > values are saved. My SearchForm has the appropriate getters and setters. > How do I accomplish this? HELP AGAIN! :) > > Is my struts-config.xml file setup incorrectly? I was unsure of the > <forward name="failure" path="/search.do"/> line below. > > <action-mappings> > <action path="/search" > type="SearchAction" > scope="session"> > <forward name="success" path="/search.jsp"/> > <forward name="failure" path="/appError.jsp"/> > </action> > > <action path = "/searchResults" > type = "SearchResultsAction" > name = "strainSearchForm" > validate = "true" > input = "/search.do"> > <forward name="success" path="/searchResults.jsp"/> > <forward name="failure" path="/search.do"/> > <forward name="error" path="/appError.jsp"/> > </action> > </action-mappings> > > > Running to get COFFEE now! > > Matt > > > > -----Original Message----- > From: Wendy Smoak [mailto:[EMAIL PROTECTED] > Sent: Wednesday, January 21, 2004 10:55 AM > To: Struts Users Mailing List > Subject: RE: Struts, Search Page, Help!!! > > > > Thanks for the advice. Now I'm just having trouble thinking. :) > > if my collection is called strainTypes, but it is jjust an > > ArrayList of > > Strings, what do I use: > > <html-el:select property="strainTypes"> > > <html-el:options collection="strainTypes" property="???????" > > labelProperty="????????"/> > > </html-el:select> > > http://jakarta.apache.org/struts/userGuide/struts-html.html#options > > It's not immediately clear, but try it with *just* 'collection' > specified. Leave off property & labelProperty, see what it does, and go > from there. > > -- > Wendy Smoak > Application Systems Analyst, Sr. > ASU IA Information Resources Management > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]