× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks Gary 

That was the trick.  I didn't understand how struts would know about the
odjb bean but it must be a lot smarter than I am.

Anyway it is working great.  Yahoo!!!!

-----Original Message-----
From: Gary L Peskin [mailto:garyp@firstech.com]
Sent: Tuesday, January 28, 2003 5:24 PM
To: 'Java Programming on and around the iSeries / AS400'
Subject: RE: Struts html:select problem


Stephen --

The html:optionsCollection tag is from the next release of Struts, which is
currently in beta.

I think you want the html:options tag (with an "s" on the end), rather than
the html:option tag.

Your code would look like this:

<html:select property="patternColor1">
  <html:options collection="styleSizeColorList" labelProperty="sizeColor"
property="style"/>
</html:select>

Struts will iterate through styleSizeColorList and pick up the odjb object
from each iteration.  Then it will call getSizeColor and getStyle on that
odjb object to get the values to use as the displayed value and returned
value, respectively.

HTH,
Gary


> -----Original Message-----
> From: java400-l-bounces@midrange.com 
> [mailto:java400-l-bounces@midrange.com] On Behalf Of Gibson.Stephen
> Sent: Tuesday, January 28, 2003 12:26 PM
> To: 'Java Programming on and around the iSeries / AS400'
> Subject: RE: Struts html:select problem
> 
> 
> Thank you for the advice.  I wish to clarify just a bit 
> further if I may. The collection name (the arrayList in the 
> selection scope) is StyleSizeColorList.  It is made up of 
> bean objects named odjb.  How do I associate the collection 
> name with the JSP form?  The bean value I want to display to 
> the user is ohjb.sizeColor but selection value I want 
> returned to the form is the ohjb.style.  How do I do that?  
> Is that the label property? Also, what does the size property 
> do? is that the number of elements in the array or the width 
> of the field?
> 
> Again, thank you for the response.
> 
> -----Original Message-----
> From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
> Sent: Tuesday, January 28, 2003 2:54 PM
> To: Java Programming on and around the iSeries / AS400
> Subject: Re: Struts html:select problem
> 
> 
> Hi try this
> <html:select property="sizeColor" size="5" > 
> <html:optionsCollection name="odjb" property="sizeColor"/> 
> </html:select>
> 
> Ashish
> --- "Gibson.Stephen" <Gibson.Stephen@burlington.com>
> wrote:
> > Greetings
> >  
> > I have a question regarding the use of html:select
> > in  Struts.  I have an
> > array list in the session scope named
> > StyleSizeColorList.  Each row of the
> > array is an "odjb" bean object.  One of the elements
> > of this bean is a
> > String named sizeColor.  I want to display this in a
> > drop down list and
> > allow the user to select the appropriate value on a html:form.  The 
> > list is displayed correctly but the selected value is the
> > literal <bean:write name
> > ='odjb' property='style' />  I need to figure out
> > how code the html:option
> > to select the value from the odjb bean property
> > style.  
> >  
> > Can anyone point me in the right direction.
> >  
> > Here is my JSP code snippet.
> >  
> >  
> > <html:select property="patternColor1">
> >     <logic:iterate id="odjb"
> > name="styleSizeColorList"  scope="session">
> >         <html:option value="<bean:write name ='odjb' 
> property='style' 
> > /> ">
> >             <bean:write name ="odjb"
> > property="sizeColor" /> 
> >         </html:option>  
> >     </logic:iterate>
> > </html:select>
> >  
> > Thanks for any assistance...
> > Steve Gibson
> > 
> >  
> > 
> > Stephen Gibson
> > 
> > Lees Carpets - IT Department
> > A Division of Burlington Industries 
> > 3330 West Friendly Avenue 
> > Greensboro, NC 27410 
> > 
> > Phone 336.379.2728
> > gibson.stephen@burlington.com 

_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo.cgi/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.