You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by PETER BLIZNAK <bl...@rogers.com> on 2006/03/07 21:41:07 UTC

Collection of Options

Hi there,
I run into something I cant figure perhaps someone
here can help me to shed some light on it. 

Basically I have dynamic table - meaning I iterate
over supplied colection and build up table. No problem
there that is simple stuff. Confusion starts when one
of the columns must be list of options (or drop-down
list) and then all need to get preselected with
different values.
I have dealt with dynamic radio and check boxes but
this seem to be different situation. I know how to
preselect ONE option box...but if there are part one
the collection  I seemed to lost handle on it. 

If I have one option box then I can use something like
this
<html:select property="siteName_1" size="0" >
								<html:options collection="sitesList"
property="siteId" labelProperty="siteName" />
							</html:select>

and then I can use property="siteName_1" to preselect
what I need but  if "siteList" is itself part of the
outer collection then what???



Any help would be appreciated
Peter. 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Collection of Options

Posted by PETER BLIZNAK <bl...@rogers.com>.
--- Rick Reumann <st...@reumann.net> wrote:

> PETER BLIZNAK wrote:
> > Hi there,
> > I run into something I cant figure perhaps someone
> > here can help me to shed some light on it. 
> > 
> > Basically I have dynamic table - meaning I iterate
> > over supplied colection and build up table. No
> problem
> > there that is simple stuff. Confusion starts when
> one
> > of the columns must be list of options (or
> drop-down
> > list) and then all need to get preselected with
> > different values.
> > I have dealt with dynamic radio and check boxes
> but
> > this seem to be different situation. I know how to
> > preselect ONE option box...but if there are part
> one
> > the collection  I seemed to lost handle on it. 
> > 
> > If I have one option box then I can use something
> like
> > this
> > <html:select property="siteName_1" size="0" >
> > 								<html:options collection="sitesList"
> > property="siteId" labelProperty="siteName" />
> > 							</html:select>
> 
> Not sure exactly what you mean? Does the select
> above need to be a 
> multiple select box? If so as long as siteName_1 is
> a String[] or List 
> you should be fine. I don't think that's what's you
> are asking though. 
> If it is a regular single select than as long as
> siteName_1 happens to 
> match one of the values in sitesList than it will
> show up selected.
> 
> I'm not sure what "sitesList" should have to do with
> it unless sitesList 
> is unique per row? If so then you'll have to pull
> sitesList from 
> whatever property you happen to be iterating over.
> 
> 
> 

Basically you answered my question in your last
sentence. Also I reliazed I would need to use
"optionsCollection" instead "options" and then declare
"id" for a bean I am iterating on. Everything works
now.
Thanks for your help.
 


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Collection of Options

Posted by Rick Reumann <st...@reumann.net>.
PETER BLIZNAK wrote:
> Hi there,
> I run into something I cant figure perhaps someone
> here can help me to shed some light on it. 
> 
> Basically I have dynamic table - meaning I iterate
> over supplied colection and build up table. No problem
> there that is simple stuff. Confusion starts when one
> of the columns must be list of options (or drop-down
> list) and then all need to get preselected with
> different values.
> I have dealt with dynamic radio and check boxes but
> this seem to be different situation. I know how to
> preselect ONE option box...but if there are part one
> the collection  I seemed to lost handle on it. 
> 
> If I have one option box then I can use something like
> this
> <html:select property="siteName_1" size="0" >
> 								<html:options collection="sitesList"
> property="siteId" labelProperty="siteName" />
> 							</html:select>

Not sure exactly what you mean? Does the select above need to be a 
multiple select box? If so as long as siteName_1 is a String[] or List 
you should be fine. I don't think that's what's you are asking though. 
If it is a regular single select than as long as siteName_1 happens to 
match one of the values in sitesList than it will show up selected.

I'm not sure what "sitesList" should have to do with it unless sitesList 
is unique per row? If so then you'll have to pull sitesList from 
whatever property you happen to be iterating over.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org