You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by croffman rhenv <my...@hotmail.com> on 2005/10/01 17:11:22 UTC

RE: form bean population confusion

Thanks for the reply.

1. Looks like I got into the problem, because of 3 pages.

I have defined action mappings as:
action1 ==> no ActionForm
action2 ==> takes a DynaValidatorForm (form1) for all the user data u
received in jsp1
action3 ==> called when jsp2 submission and displays jsp3
2. Is it correct to take the form name for the action3 as "form2".

Action1 is invoked ==> there is no form attached to it. it's fine.
Action2 is invoked ==> form1 is populated with input data for search at RUN
TIME (seen in debug in mode action class). But when coming on page2 display,
it is empty.

In jsp2, I used
<html:form action="/action 3">
    <html:text property="lastName">
      .....
</html:form>,
3. I didn't specify name attribute in <hml:text> and <html:form>tags. Does
this cause any problem?

I saw page2 view source as:
<form name="form2" method="post" action="/contextRoot/action3.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>

Croff

----- Original Message -----
From: "rahul" <ra...@amsoft.net>
To: "Struts Users Mailing List" <us...@struts.apache.org>
Sent: Friday, September 30, 2005 9:35 AM
Subject: RE: form bean population confusion


>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
>
>



>From: "rahul" <ra...@amsoft.net>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Subject: RE: form bean population confusion
>Date: Fri, 30 Sep 2005 20:05:09 +0530
>
>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
>
>

_________________________________________________________________
On the road to retirement? Check out MSN Life Events for advice on how to 
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement


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


RE: form bean population confusion

Posted by croffman rhenv <my...@hotmail.com>.
This approach I 've implemented with a sample of 3 pages, worked great. But
after getting into this problem, things have changed a little bit and design 
team concluded to have one form bean for multiple pages, which in turn not 
got into the problem again.

Your inputs were helpful. Thank You.

Croff


>From: "rahul" <ra...@amsoft.net>
>Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>To: "Struts Users Mailing List" <us...@struts.apache.org>
>Subject: RE: form bean population confusion
>Date: Mon, 03 Oct 2005 10:25:15 +0530
>
>see inline comments #####
>
> > -----Original Message-----
> > From: croffman rhenv [mailto:mystruts2004@hotmail.com]
> > Sent: Saturday, October 01, 2005 8:41 PM
> > To: user@struts.apache.org
> > Subject: RE: form bean population confusion
> >
> >
> > Thanks for the reply.
> >
> > 1. Looks like I got into the problem, because of 3 pages.
> >
> > I have defined action mappings as:
> > action1 ==> no ActionForm
> > action2 ==> takes a DynaValidatorForm (form1) for all the user data u
> > received in jsp1
> > action3 ==> called when jsp2 submission and displays jsp3
> > 2. Is it correct to take the form name for the action3 as "form2".
> >
> > Action1 is invoked ==> there is no form attached to it. it's fine.
> > Action2 is invoked ==> form1 is populated with input data for
> > search at RUN
> > TIME (seen in debug in mode action class). But when coming on
> > page2 display,
> > it is empty.
> >
>####
>	Before forwarding the request to jsp2 in action2, u need to
>	set the data either in session or in request as an attribute.
>	In the form of some bean.
>	Then use following in jsp2
>	<html:form action="/action 3" >
>		<html:text property="lastName" name="beanName" />
>		....
>	</html:form>
>	where "beanName" is the name by which u have set the attribute in
>	session or in request.
>
>
>
> > In jsp2, I used
> > <html:form action="/action 3">
> >     <html:text property="lastName">
> >       .....
> > </html:form>,
> > 3. I didn't specify name attribute in <hml:text> and <html:form>tags. 
>Does
> > this cause any problem?
> >
> > I saw page2 view source as:
> > <form name="form2" method="post" action="/contextRoot/action3.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>
> >
> > Croff
> >
> > ----- Original Message -----
> > From: "rahul" <ra...@amsoft.net>
> > To: "Struts Users Mailing List" <us...@struts.apache.org>
> > Sent: Friday, September 30, 2005 9:35 AM
> > Subject: RE: form bean population confusion
> >
> >
> > >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
> > >
> > >
> >
> >
> >
> > >From: "rahul" <ra...@amsoft.net>
> > >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >To: "Struts Users Mailing List" <us...@struts.apache.org>
> > >Subject: RE: form bean population confusion
> > >Date: Fri, 30 Sep 2005 20:05:09 +0530
> > >
> > >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
> > >
> > >
> >
> > _________________________________________________________________
> > On the road to retirement? Check out MSN Life Events for advice on how 
>to
> > get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
> >
> >
> > ---------------------------------------------------------------------
> > 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
>

_________________________________________________________________
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


RE: form bean population confusion

Posted by rahul <ra...@amsoft.net>.
see inline comments #####

> -----Original Message-----
> From: croffman rhenv [mailto:mystruts2004@hotmail.com]
> Sent: Saturday, October 01, 2005 8:41 PM
> To: user@struts.apache.org
> Subject: RE: form bean population confusion
>
>
> Thanks for the reply.
>
> 1. Looks like I got into the problem, because of 3 pages.
>
> I have defined action mappings as:
> action1 ==> no ActionForm
> action2 ==> takes a DynaValidatorForm (form1) for all the user data u
> received in jsp1
> action3 ==> called when jsp2 submission and displays jsp3
> 2. Is it correct to take the form name for the action3 as "form2".
>
> Action1 is invoked ==> there is no form attached to it. it's fine.
> Action2 is invoked ==> form1 is populated with input data for
> search at RUN
> TIME (seen in debug in mode action class). But when coming on
> page2 display,
> it is empty.
>
####
	Before forwarding the request to jsp2 in action2, u need to
	set the data either in session or in request as an attribute.
	In the form of some bean.
	Then use following in jsp2
	<html:form action="/action 3" >
		<html:text property="lastName" name="beanName" />
		....
	</html:form>
	where "beanName" is the name by which u have set the attribute in
	session or in request.



> In jsp2, I used
> <html:form action="/action 3">
>     <html:text property="lastName">
>       .....
> </html:form>,
> 3. I didn't specify name attribute in <hml:text> and <html:form>tags. Does
> this cause any problem?
>
> I saw page2 view source as:
> <form name="form2" method="post" action="/contextRoot/action3.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>
>
> Croff
>
> ----- Original Message -----
> From: "rahul" <ra...@amsoft.net>
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Sent: Friday, September 30, 2005 9:35 AM
> Subject: RE: form bean population confusion
>
>
> >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
> >
> >
>
>
>
> >From: "rahul" <ra...@amsoft.net>
> >Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> >To: "Struts Users Mailing List" <us...@struts.apache.org>
> >Subject: RE: form bean population confusion
> >Date: Fri, 30 Sep 2005 20:05:09 +0530
> >
> >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
> >
> >
>
> _________________________________________________________________
> On the road to retirement? Check out MSN Life Events for advice on how to
> get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
>
>
> ---------------------------------------------------------------------
> 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