Like in my two previous emails, it worked when I took out the "name" and "type"
attributes in your html form:

<%--
<html-el:form action="searchResults"
           name="itemSearch"
           type="SearchForm">
--%>
<html-el:form action="searchResults">

hth,
Hubert

--- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote:
> http:// www ! moosejaw ! org /java/help.zip
> 
> Here is a zip file to demonstrate the problem I am having.  I just hacked
> this together, but it shows what I have been talking about.
> 
> 1. Unzip this and put the helpv1.war in your webapps folder
> 2. Start servlet container
> 3. Goto http://localhost:8888/helpv1
> 
> This should take you to index.do which is fine.  Click "Search" which takes
> you top search.do.  Type "1" for the Item Id and select "Lable 2" for the
> Utem Type and click "Search".  Do you see how the values are lost?  How can
> I mantain those values?  Should I just have 1 Action class that handles both
> the search form and the search results?  If so, how do I set this up?
> 
> Thanks for your help!
> 
> Matt
> 
> 
> 
> -----Original Message-----
> From: Hubert Rabago [mailto:[EMAIL PROTECTED]
> Sent: Friday, January 23, 2004 11:31 AM
> To: Struts Users Mailing List
> Subject: Re: Strust Search/Results/Display HELP!
> 
> 
> For your steps 2 to 4:
> 
> in your struts-config:
> 
> <form-bean name="myForm" type="com.my.form.MyForm"/>
> ...
> <action path="/pageWithForm" type="com.my.action.PreparePageAction">
>     <forward name="showForm" path="/form.jsp">
> </action>
> <action path="/formDestination"
>     type="com.my.action.PreparePageAction"
>     name="myForm"
>     input="/form.jsp">
>     ...  <!-- show page for step 4 -->
> </action>
> 
> 
> in your jsp:
> <html:form action="/formDestination">
>     <html:text property="someMyFormProperty"/>
>     <html:text property="otherMyFormProperty"/>
>     <html:submit/>
> </html:form>
> <%-- also use the struts tags to display error messages --%>
> 
> 
> In your case, you may need to use input="/pageWithForm.do" since you need to
> prep
> the form, but there are other ways to do that, like placing your <SELECT>'s
> options collection in session or app scope.  However, I *have* used this
> approach
> before and it worked for me.
> 
> hth,
> Hubert
> 
> --- "Matthew J. Vincent" <[EMAIL PROTECTED]> wrote:
> > Ok.  I guess I'm missing something - or it just won't sink in.  This
> really
> > isn't that long.
> >
> > For simplicity, let's say I have a 4 page application.
> >
> > 1. Index
> > 2. Search for an Item
> > 3. Search Results List of Matching items
> > 4. Details of an Item
> >
> > All of these "pages" needs to gather data from a database (not the
> problem)
> > and display to them to the end user.
> >
> > A typical scenario for a user would be:
> >
> > 1. User goes to http://localhost:8888/protoype they will land on the index
> > page that really needs to be an Action because it looks up data from the
> > database.
> > 2. They click search which also gathers data from the database to display
> a
> > form.
> > 3. They fill the form in and click Search.
> > 4. They see the matching search results.
> > 5. They pick the matching search result and the Item is displayed.
> >
> > Each page is essentially an action that forwards it's results to a jsp
> page.
> >
> > However, here is the problem I am having.  When an error occurs, I need to
> > have that error displayed to the end user and have them on the previous
> > page.
> >
> > For example, Step 2 to Step 3 from above - if the user does not type in a
> > required field or there are no results, they need to be told this and
> placed
> > back on Step 2 with:
> > 1. the form values filled out with what they submitted
> > 2. this page needs to gather the data from the database again (in case
> more
> > data has been added).
> >
> > So I'm not sure of:
> >
> > 1. What do I need to put in the struts-config.xml file (specifically in
> the
> > Action Mappings section)
> >
> >       <action path="/search"
> >               type="SearchAction">
> >          <forward name="success" path="/search.jsp"/>
> >          <forward name="failure" path="/appError.jsp"/>
> >       </action>
> >       <action path = "/searchResults"
> >               type = "SearchResultsAction"
> >               name = "strainSearchForm"
> >               validate = "true"  <---------- I know will call the validate
> > method
> >               input = "/search.do"> <---------- can this be an Action?
> >          <forward name="success" path="/searchResults.jsp"/>
> >          <forward name="failure" path="/search.do"/>  <---------- If this
> is
> > search.jsp, the data from the database is not regathered
> >          <forward name="error" path="/appError.jsp"/>
> >       </action>
> >
> >
> > 2. Should I have 1 action or is having multiple actions ok?  If just 1
> > action, how do I set this up?
> >
> > 3. What is the best approach for this type of scenario?  I can solve this
> > fine with a straight Servlet and JSP approach, but what is the "Struts
> way"?
> >
> > Hubert and Wendy have answered my questions, but I am recovering from a
> cold
> > and nothing is getting into my brain.
> >
> > Thanks for the help.  Be gentle and explain slowly.  :)
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free web site building tool. Try it!
> http://webhosting.yahoo.com/ps/sb/
> 
> ---------------------------------------------------------------------
> 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! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to