You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by zakaria ghandour <zg...@pentalog.fr> on 2008/04/21 11:49:39 UTC
insert multiple objects in same form
Hi,
in my struts form i have 2 <html:text> to insert date and time.
i want to insert more than one object in my "Struts action" (using iteration
to display inputs in form).
how can i name my <html:text> to dont have conflict name, and how can i
recover the values of these inputs
in "struts action".
<tr>
<td><fmt:message key="label.date"/>:</td>
<td><html:text property="date" size="10" name="date"/> <html:errors
property="date"/></td>
</tr>
<tr>
<td><fmt:message key="label.heure"/>:</td>
<td><html:text property="heure" size="10" name="heure"/> <html:errors
property="heure"/></td>
</tr>
thanks.
--
View this message in context: http://www.nabble.com/insert-multiple-objects-in-same-form-tp16806476p16806476.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: insert multiple objects in same form
Posted by zakaria ghandour <zg...@pentalog.fr>.
HI,
i found solution to my problem.
+ this is the jsp
-------------------------------------------------------
<c:forEach var="i" items="1,2,3,4,5,6">
<tr>
<td><fmt:message key="label.date"/>:</td>
<td><html:text property="date" size="10"/></td>
<td>jj/mm/aaaa</td>
<td><fmt:message key="label.heure"/>:</td>
<td><html:text property="heure" size="10"/></td>
<td>hh:mm</td>
</tr>
</c:forEach>
+ in the ActionForm i declared
--------------------------------------
private String date[];
private String heure[];
+ in the DispatchAction i use the date[]; and heure[]; getters to recover
all values
do you think that this solution is correct
thanks
--
View this message in context: http://www.nabble.com/insert-multiple-objects-in-same-form-tp16806476p16846048.html
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: insert multiple objects in same form
Posted by Laurie Harper <la...@holoweb.net>.
zakaria ghandour wrote:
> Hi,
>
> in my struts form i have 2 <html:text> to insert date and time.
> i want to insert more than one object in my "Struts action" (using iteration
> to display inputs in form).
> how can i name my <html:text> to dont have conflict name, and how can i
> recover the values of these inputs
> in "struts action".
>
> <tr>
> <td><fmt:message key="label.date"/>:</td>
> <td><html:text property="date" size="10" name="date"/> <html:errors
> property="date"/></td>
> </tr>
> <tr>
> <td><fmt:message key="label.heure"/>:</td>
> <td><html:text property="heure" size="10" name="heure"/> <html:errors
> property="heure"/></td>
> </tr>
I don't know what you mean by conflicting names; you have two text
inputs, each with a distinct name. Where is the conflict? As to how to
'recover the values of these inputs', you just need setters on your form
bean, same as usual.
One slight oddity in your sample code above is the use of both 'name'
and 'property' attributes. Unless you are specifically intending to
bypass the form bean, you probably don't want the 'name' attribute.
L.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org