--- On Mon, 8/11/08, Haulyn R. Jason wrote:
> I mean , I know how to populate data to a select tag, and I
> know how to collection data from a select tag, but the problem
> is: If the list I want to collection from select tag is not a
> simple data type(String), but it's another object, how can I do
> that?
There are at least two options; using the <s:select...> tag or building the
options manually.
If you're using the <s:select...> tag, assuming a list of "Foo" objects with
"id" and "bar" properties:
<s:select list="listOfFoo" listKey="id" listValue="bar" value="foos"/>
See the <s:select...> tag documentation [1].
If you're building the options by hand:
<select name="foos">
<c:forEach value="${listOfFoos}" var="foo">
<option value="${foo.id}">${foo.bar}</option>
</c:forEach>
</select>
(You'd also need logic to determine if the option should be selected.)
Some of the information on the tag syntax page [2] might also be of interest.
Dave
[1] <s:select...> tag:
http://struts.apache.org/2.x/docs/select.html
[2] Tag syntax:
http://struts.apache.org/2.x/docs/tag-syntax.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]