You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Andy Cheng <an...@pos.st> on 2003/08/05 04:49:53 UTC
Display vector with htmltable?
Is it possible to display a vector containing a list of other objects in
the request object using htmltable? I have tried reading the examples
in the v0.4 RC-1, but it is just far too complex for a newbie to follow.
Please kindly point me to a place where there are examples in using
vector, or even better, give me an example of the configuration files,
and may be some code?
Thanks
Andy
Re: Display vector with htmltable?
Posted by Kwok Peng Tuck <pe...@makmal.net>.
Here's a example I did :
<html:select property="offset" >
<html:optionsCollection label="date" name="DATE" value="value"
property="dates" ></html:optionsCollection>
</html:select>
'DATE' is a bean which has a attribute called 'dates' which returns a
(Vector) collection of beans. The beans in this collection consist of
two attributes, date (String) and value (int).
Thus when rendering the select box, the date is used as the label, so to
the user strings like '2003-08-05' will appear and the value attribute
will be used to populate the value field for each label.
The tags above will render the html bellow:
<select name="offset"><option value="0" selected="selected">05-08-2003</option>
<option value="1">04-08-2003</option>
<option value="2">03-08-2003</option>
<option value="3">02-08-2003</option>
<option value="4">01-08-2003</option>
<option value="5">31-07-2003</option>
<option value="6">30-07-2003</option></select>
I attached this to a html:form tag, thus the bean which returns the
collection ('DATE') is looked for in the same scope as the form (request
in this case) .
Andy Cheng wrote:
>Is it possible to display a vector containing a list of other objects in
>the request object using htmltable? I have tried reading the examples
>in the v0.4 RC-1, but it is just far too complex for a newbie to follow.
>Please kindly point me to a place where there are examples in using
>vector, or even better, give me an example of the configuration files,
>and may be some code?
>
>Thanks
>
>Andy
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org