[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    RE: form bean population confusion
From:       "rahul" <rahul.joshi () amsoft ! net>
Date:       2005-09-30 14:47:09
Message-ID: PEEGKOLDMINLCNPONKGCKENKCCAA.rahul.joshi () amsoft ! net
[Download RAW message or body]

I am not sure, what you want to show on jsp2
but let me try..

you said you want to submit some DATA from PAGE 1
then retrieve some info from database and show that data
in PAGE 2

But the mapping you shown is not correct for that
follow these steps

1. Create a mapping for action1 which does not take any
ActionForm.

2. Forward the request from that action1 to some jsp1
which will take the input from user(i.e. searchType,age ...)

3. Create a mapping for action2 which takes a  DynaValidatorForm
for all the user data u received in jsp1

4. Extract the info from database using data received
in DynaValidatorForm

5. Set the data in session or request scope in the form of a Bean

6. Forward the request to jsp2

7. In jsp2 show the data using <html:bean> tag or in the form
of html form if you want to again send that data to some third
action.


  --Rahul



> -----Original Message-----
> From: my struts [mailto:mystruts2004@hotmail.com]
> Sent: Friday, September 30, 2005 7:19 PM
> To: user@struts.apache.org
> Subject: form bean population confusion
>
>
> Hi,
>
> I am lost in the basics.
>
> Problem: When PAGE 1 DATA is submitted then (back end will
> retrieve the info
> from database) and PAGE 2 should be displayed with DATA. But the
> population
> is not happening, I am lost in basics. Please clarify.
>
> Here is the information on my form-beans and action-mappings.
>
> Form-beans:
> ==========
> <form-bean name="searchForm"
> type="org.apache.struts.validator.DynaValidatorForm">
>          <form-property name="searchType" type="java.lang.String" />
>          <form-property name="insId" type="java.math.BigDecimal" />
>          <form-property name="age" type="java.lang.Integer" />
> </form-bean>
> <form-bean name="resultsForm"
> type="org.apache.struts.validator.DynaValidatorForm">
>          <form-property name="lastName" type="java.lang.String" />
>          <form-property name="firstName" type="java.lang.String" />
>          <form-property name="address" type="java.lang.String" />
>          <form-property name="zip" type="java.lang.String" />
>   .............
> </form-bean>
> <form-bean name="editAndConfirmForm"
> type="org.apache.struts.validator.DynaValidatorForm">
> .............
> </form-bean>
>
> action mappings:
> ============
> <action path="/search" type="InsAction" name="searchForm" scope="request"
> validate="false">
>      <forward name="success" path="tile definition for page 1
> display or jsp
> for display" />
> </action>
> <action path="/results" type="InsAction" name="resultsForm"
> input="definition for page 1 display" scope="request" validate="false">
>      <forward name="success" path="tile definition for page 2
> display or jsp
> for display" />
> </action>
> <action path="/confirm" type="InsAction" name="editAndConfirmForm"
> input="definition for page 2 display" scope="request" validate="false">
>      <forward name="success" path="tile definition for page 3
> display or jsp
> for display" />
> </action>
>
> Control Flow:
> =========
> 1. When Search link is clicked, search page (/search mapping is
> called) is
> displayed with the search EMPTY fields.
> 2. When search form is submitted (searchType, insId and age fields), then
> results page should be displayed with populated information. This is not
> happening. When search form is submitted the data is being populated and
> when I checked in the action classes in debug mode, I have seen
> the data IS
> POPULATED in the searchForm.  On PAGE 2 jsp's I have <html: text > fields
> with no name of the form, so it takes the default from the
> html:form which
> is I have defined it as <html:form action="/results">. I think,
> the fields
> on page 2 are taking resultsForm which is not populated. I am
> lost here, how
> multiple pages are generally managed.
>
> When I did the view source on PAGE  2, it showed
> <form name="resultsForm" method="post" action="/contextRoot/confirm.do">
> <input type="text" name="lastName" value="">
> <input type="text" name="firstName" value="">
> <input type="text" name="address" value="">
> <input type="text" name="zip" value="">
> </form>
>
> I am confused. Please help in this basics.
>
> Thanks in advance.
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today -
> it's FREE!
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic