You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Tien Nguyen <ti...@yahoo.de> on 2003/07/01 16:07:09 UTC
Initialize Struts form with request parameters
Hi all,
I have a problem with struts form.
The form is:
<html:form action="chooseTrainee">
<html:hidden property="traineeId"/>
<html:text property="name"/>
<html:submit value="Submit"/>
</html:form>
and the ActionForm has the following properties (fields and
getters/setters):
traineeId
name
What I want is: the traineeId must be initialized by a value passed via
URL:
e.g: http://localhost/test/chooseTraineePage.jsp?traineeId=12345
How can I do that?
Your reply is highly appreciated!
Thanks
Tien
-----Original Message-----
From: struts-user-digest-help@jakarta.apache.org
[mailto:struts-user-digest-help@jakarta.apache.org]
Sent: Tuesday, July 01, 2003 3:08 PM
To: struts-user@jakarta.apache.org
Subject: struts-user Digest 1 Jul 2003 13:07:49 -0000 Issue 3513
struts-user Digest 1 Jul 2003 13:07:49 -0000 Issue 3513
Topics (messages 84024 through 84051):
show selected value in html:options field
84024 by: Stefan Schaebel
Re: <logic:equal> with sessionAttributes
84025 by: Nicolas De Loof
84026 by: Filip Polsakiewicz
Re: [ANNOUNCEMENT] Struts 1.1 Final released
84027 by: Arnaud HERITIER
Re: Can I have a _not_ URL encoded?
84028 by: Marco Maier
84029 by: Samuel.Opoku-Boadu.t-systems.com
Re: setting input for action
84030 by: thart.part.net
Validations in Struts 1.0
84031 by: sriram
Populating select boxes dynamically
84032 by: sriram
84043 by: Alex Shneyderman
disabling form element
84033 by: Frances Aleah Z. de Guzman
84034 by: Mark Lowe
REPOST: Help! - java.security.AccessControlException
84035 by: White, Joshua A (HTSC, CASD)
Problem With Struts1.1 Example
84036 by: Saroj Kumar Choudhury
knowing which DispatchAction called an Action
84037 by: Ionel Gardais
where does a form element get and put it's data
84038 by: Heather Buch
84040 by: Adam Hardy
Newbie question: DispatchAction subclassing
84039 by: Paula Coll
Upgrading to Struts 1.1
84041 by: Natalie D Rassmann
84051 by: Hajratwala, Nayan (N.)
Display table contents
84042 by: Arnost Foo
Tag to remove jsp from cache???
84044 by: Prashanth.S
84046 by: Alex Shneyderman
84048 by: Nicolas De Loof
External style sheets and tiles.
84045 by: James Watkins
84047 by: Nicolas De Loof
Could not parse deployment descriptor: java.io.IOException: cannot
resolve '/WEB-INF/struts-bean.tld' into a valid tag library
84049 by: PREETAM Balijepalli
84050 by: Adam Hardy
Administrivia:
To subscribe to the digest, e-mail:
struts-user-digest-subscribe@jakarta.apache.org
To unsubscribe from the digest, e-mail:
struts-user-digest-unsubscribe@jakarta.apache.org
To post to the list, e-mail:
struts-user@jakarta.apache.org
----------------------------------------------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Initialize Struts form with request parameters
Posted by Dan Tran <da...@hotmail.com>.
Adam's answer is absolutely correct, however let me add more details
to make your job a little bit easier.
1. Create and action called loadTrainee.do and associate this action
with your form. with a forward to chooseTraineePage.jsp
2. Invoke chooseTranies.do?traineeId=xxxx, struts, will call the
action in 1 and automatically populate your form's traineeId for you
3. In action1, write some code to use traineeId to fill "name", struts will
then forward your form to chooseTraineePage.jsp to display
In summary, you need 2 actions, one to to load the form and the other one
is to manipulate the form
Hope this helps
-D
----- Original Message -----
From: "Adam Hardy" <ah...@cyberspaceroad.com>
Newsgroups: Struts
Sent: Tuesday, July 01, 2003 7:26 AM
Subject: Re: Initialize Struts form with request parameters
> This would happen automatically if you access the JSP via an action
> mapping in your struts-config. You specify the action class, the action
> form and the forward/jsp. struts will automatically instantiate the form
> when the request comes in and populate the form properties with any
> equivalent request parameters.
>
> hth
> Adam
>
> Tien Nguyen wrote:
> > Hi all,
> > I have a problem with struts form.
> >
> > The form is:
> > <html:form action="chooseTrainee">
> > <html:hidden property="traineeId"/>
> > <html:text property="name"/>
> > <html:submit value="Submit"/>
> > </html:form>
> >
> > and the ActionForm has the following properties (fields and
> > getters/setters):
> > traineeId
> > name
> >
> > What I want is: the traineeId must be initialized by a value passed via
> > URL:
> > e.g: http://localhost/test/chooseTraineePage.jsp?traineeId=12345
> >
> > How can I do that?
> > Your reply is highly appreciated!
> > Thanks
> > Tien
> >
> > -----Original Message-----
> > From: struts-user-digest-help@jakarta.apache.org
> > [mailto:struts-user-digest-help@jakarta.apache.org]
> > Sent: Tuesday, July 01, 2003 3:08 PM
> > To: struts-user@jakarta.apache.org
> > Subject: struts-user Digest 1 Jul 2003 13:07:49 -0000 Issue 3513
> >
> >
> > struts-user Digest 1 Jul 2003 13:07:49 -0000 Issue 3513
> >
> > Topics (messages 84024 through 84051):
> >
> > show selected value in html:options field
> > 84024 by: Stefan Schaebel
> >
> > Re: <logic:equal> with sessionAttributes
> > 84025 by: Nicolas De Loof
> > 84026 by: Filip Polsakiewicz
> >
> > Re: [ANNOUNCEMENT] Struts 1.1 Final released
> > 84027 by: Arnaud HERITIER
> >
> > Re: Can I have a _not_ URL encoded?
> > 84028 by: Marco Maier
> > 84029 by: Samuel.Opoku-Boadu.t-systems.com
> >
> > Re: setting input for action
> > 84030 by: thart.part.net
> >
> > Validations in Struts 1.0
> > 84031 by: sriram
> >
> > Populating select boxes dynamically
> > 84032 by: sriram
> > 84043 by: Alex Shneyderman
> >
> > disabling form element
> > 84033 by: Frances Aleah Z. de Guzman
> > 84034 by: Mark Lowe
> >
> > REPOST: Help! - java.security.AccessControlException
> > 84035 by: White, Joshua A (HTSC, CASD)
> >
> > Problem With Struts1.1 Example
> > 84036 by: Saroj Kumar Choudhury
> >
> > knowing which DispatchAction called an Action
> > 84037 by: Ionel Gardais
> >
> > where does a form element get and put it's data
> > 84038 by: Heather Buch
> > 84040 by: Adam Hardy
> >
> > Newbie question: DispatchAction subclassing
> > 84039 by: Paula Coll
> >
> > Upgrading to Struts 1.1
> > 84041 by: Natalie D Rassmann
> > 84051 by: Hajratwala, Nayan (N.)
> >
> > Display table contents
> > 84042 by: Arnost Foo
> >
> > Tag to remove jsp from cache???
> > 84044 by: Prashanth.S
> > 84046 by: Alex Shneyderman
> > 84048 by: Nicolas De Loof
> >
> > External style sheets and tiles.
> > 84045 by: James Watkins
> > 84047 by: Nicolas De Loof
> >
> > Could not parse deployment descriptor: java.io.IOException: cannot
> > resolve '/WEB-INF/struts-bean.tld' into a valid tag library
> > 84049 by: PREETAM Balijepalli
> > 84050 by: Adam Hardy
> >
> > Administrivia:
> >
> > To subscribe to the digest, e-mail:
> > struts-user-digest-subscribe@jakarta.apache.org
> >
> > To unsubscribe from the digest, e-mail:
> > struts-user-digest-unsubscribe@jakarta.apache.org
> >
> > To post to the list, e-mail:
> > struts-user@jakarta.apache.org
> >
> >
> > ----------------------------------------------------------------------
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: struts-user-help@jakarta.apache.org
> >
> >
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org
Re: Initialize Struts form with request parameters
Posted by Adam Hardy <ah...@cyberspaceroad.com>.
This would happen automatically if you access the JSP via an action
mapping in your struts-config. You specify the action class, the action
form and the forward/jsp. struts will automatically instantiate the form
when the request comes in and populate the form properties with any
equivalent request parameters.
hth
Adam
Tien Nguyen wrote:
> Hi all,
> I have a problem with struts form.
>
> The form is:
> <html:form action="chooseTrainee">
> <html:hidden property="traineeId"/>
> <html:text property="name"/>
> <html:submit value="Submit"/>
> </html:form>
>
> and the ActionForm has the following properties (fields and
> getters/setters):
> traineeId
> name
>
> What I want is: the traineeId must be initialized by a value passed via
> URL:
> e.g: http://localhost/test/chooseTraineePage.jsp?traineeId=12345
>
> How can I do that?
> Your reply is highly appreciated!
> Thanks
> Tien
>
> -----Original Message-----
> From: struts-user-digest-help@jakarta.apache.org
> [mailto:struts-user-digest-help@jakarta.apache.org]
> Sent: Tuesday, July 01, 2003 3:08 PM
> To: struts-user@jakarta.apache.org
> Subject: struts-user Digest 1 Jul 2003 13:07:49 -0000 Issue 3513
>
>
> struts-user Digest 1 Jul 2003 13:07:49 -0000 Issue 3513
>
> Topics (messages 84024 through 84051):
>
> show selected value in html:options field
> 84024 by: Stefan Schaebel
>
> Re: <logic:equal> with sessionAttributes
> 84025 by: Nicolas De Loof
> 84026 by: Filip Polsakiewicz
>
> Re: [ANNOUNCEMENT] Struts 1.1 Final released
> 84027 by: Arnaud HERITIER
>
> Re: Can I have a _not_ URL encoded?
> 84028 by: Marco Maier
> 84029 by: Samuel.Opoku-Boadu.t-systems.com
>
> Re: setting input for action
> 84030 by: thart.part.net
>
> Validations in Struts 1.0
> 84031 by: sriram
>
> Populating select boxes dynamically
> 84032 by: sriram
> 84043 by: Alex Shneyderman
>
> disabling form element
> 84033 by: Frances Aleah Z. de Guzman
> 84034 by: Mark Lowe
>
> REPOST: Help! - java.security.AccessControlException
> 84035 by: White, Joshua A (HTSC, CASD)
>
> Problem With Struts1.1 Example
> 84036 by: Saroj Kumar Choudhury
>
> knowing which DispatchAction called an Action
> 84037 by: Ionel Gardais
>
> where does a form element get and put it's data
> 84038 by: Heather Buch
> 84040 by: Adam Hardy
>
> Newbie question: DispatchAction subclassing
> 84039 by: Paula Coll
>
> Upgrading to Struts 1.1
> 84041 by: Natalie D Rassmann
> 84051 by: Hajratwala, Nayan (N.)
>
> Display table contents
> 84042 by: Arnost Foo
>
> Tag to remove jsp from cache???
> 84044 by: Prashanth.S
> 84046 by: Alex Shneyderman
> 84048 by: Nicolas De Loof
>
> External style sheets and tiles.
> 84045 by: James Watkins
> 84047 by: Nicolas De Loof
>
> Could not parse deployment descriptor: java.io.IOException: cannot
> resolve '/WEB-INF/struts-bean.tld' into a valid tag library
> 84049 by: PREETAM Balijepalli
> 84050 by: Adam Hardy
>
> Administrivia:
>
> To subscribe to the digest, e-mail:
> struts-user-digest-subscribe@jakarta.apache.org
>
> To unsubscribe from the digest, e-mail:
> struts-user-digest-unsubscribe@jakarta.apache.org
>
> To post to the list, e-mail:
> struts-user@jakarta.apache.org
>
>
> ----------------------------------------------------------------------
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org