You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Callaghan <gr...@hotmail.com> on 2001/11/28 01:31:58 UTC
Display a value from a List in a FormBean based on List.id = x ???
Hi,
Does anyone know an easy way to, an a JSP using struts tags, print out the
value from a particular object in a FormBean list. For example say,
* FormBean - Has an element which is a List
* This List holds several Objects
* Each Object has a getId() and getTitle()
The question is how to print the TITLE for the list item where ID=5 say. Is
there a way to do this directly? Would one have to use an iterate loop?
Background - Currently have a form which uses the following technique to
display options (see code below). If however this particular field can't be
modified I was to display the current selection (including title) in normal
bolded text, and not have the options.
----------------------------
<bean:define id="sg_opts" name="EventForm" property="sg_options"
type="java.util.List" />
<html:select property="s_sg">
<html:option key="option_label_selectone" value=""/>
<html:options collection="sg_opts" property="id" labelProperty="title"/>
</html:select>
------------------------------
Thanks in advance
Greg
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>