You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Timo Tjäder <tj...@mikropc.net> on 2004/03/14 09:07:29 UTC

Using optionsCollection - LabelValueBean

Hi,

I have problems with optionsCollection, when used with <html:select>
custom tag.

1. I set up in a bean LabelValueBean object in a Vector
2. pass it back to form and try to create a <html:selec>

This part should display a combo box with options, but
it just does not work. It does not display anything.

Html code is as follows:

<html:select style="font-size: 10px;" property="goTo" size="1">
<html:optionsCollection name="PageDetailView" 
property="totalNumOfPagesCollection"/>
</html:select>

I have checked using struts "bean:write" the contents of 
the object. Bean write claims that totalNumOfPages really 
contains LabelValueBean-objects (14 peaces).
LabelValueBean[1, 1], LabelValueBean[2, 2], LabelValueBean[3, 3], 
...

So, does anyone know how to reference to this object correctly.
Current solution does not diaplay anything to the screen.

Thanks,

Timo

So what I'd like to do is display a selection list of
all availabele pages from which user choose one and press
a goTo page button. This is quite common web control in
any web pages.


....
<logic:equal name="PageDetailView" property="linkType" 
value="add-total-num-of-pages-collection">
<bean:write name="PageDetailView.totalNumOfPagesCollection" 
property="LabelValueBean"/>                                      

<html:select style="font-size: 10px;" property="goTo" size="1">
<html:optionsCollection name="PageDetailView" 
property="totalNumOfPagesCollection"/>
</html:select>
</logic:equal>                			
	                


[1]  2 3 4 5 next »  Result 14 pages. 
....
ÄLabelValueBeanÄ1, 1Å, LabelValueBeanÄ2, 2Å, LabelValueBeanÄ3, 3Å, 
LabelValueBeanÄ4, 4Å, LabelValueBeanÄ5, 5Å, LabelValueBeanÄ6, 6Å, 
LabelValueBeanÄ7, 7Å, LabelValueBeanÄ8, 8Å, LabelValueBeanÄ9, 9Å, 
LabelValueBeanÄ10, 10Å, LabelValueBeanÄ11, 11Å, LabelValueBeanÄ12, 
12Å, LabelValueBeanÄ13, 13Å, LabelValueBeanÄ14, 14ÅÅ


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


Re: Using optionsCollection - LabelValueBean

Posted by Hubert Rabago <ja...@yahoo.com>.
The <html:select> needs to be provided with the property it's associated to,
the one on your form bean that will hold the actual value selected.

<html:select property="mySelectValue" style="font-size: 10px;"
property="goTo" size="1">
    <html:optionsCollection 
        name="PageDetailView"
        property="totalNumOfPagesCollection"
        />
</html:select>

"mySelectValue" should be a property on your form bean.

hth,

Hubert



--- Timo_Tj�der <tj...@mikropc.net> wrote:
> Hi,
> 
> I have problems with optionsCollection, when used with <html:select>
> custom tag.
> 
> 1. I set up in a bean LabelValueBean object in a Vector
> 2. pass it back to form and try to create a <html:selec>
> 
> This part should display a combo box with options, but
> it just does not work. It does not display anything.
> 
> Html code is as follows:
> 
> <html:select style="font-size: 10px;" property="goTo" size="1">
> <html:optionsCollection name="PageDetailView" 
> property="totalNumOfPagesCollection"/>
> </html:select>
> 
> I have checked using struts "bean:write" the contents of 
> the object. Bean write claims that totalNumOfPages really 
> contains LabelValueBean-objects (14 peaces).
> LabelValueBean[1, 1], LabelValueBean[2, 2], LabelValueBean[3, 3], 
> ...
> 
> So, does anyone know how to reference to this object correctly.
> Current solution does not diaplay anything to the screen.
> 
> Thanks,
> 
> Timo
> 
> So what I'd like to do is display a selection list of
> all availabele pages from which user choose one and press
> a goTo page button. This is quite common web control in
> any web pages.
> 
> 
> ....
> <logic:equal name="PageDetailView" property="linkType" 
> value="add-total-num-of-pages-collection">
> <bean:write name="PageDetailView.totalNumOfPagesCollection" 
> property="LabelValueBean"/>                                      
> 
> <html:select style="font-size: 10px;" property="goTo" size="1">
> <html:optionsCollection name="PageDetailView" 
> property="totalNumOfPagesCollection"/>
> </html:select>
> </logic:equal>                			
> 	                
> 
> 
> [1]  2 3 4 5 next �  Result 14 pages. 
> ....
> �LabelValueBean�1, 1�, LabelValueBean�2, 2�, LabelValueBean�3, 3�, 
> LabelValueBean�4, 4�, LabelValueBean�5, 5�, LabelValueBean�6, 6�, 
> LabelValueBean�7, 7�, LabelValueBean�8, 8�, LabelValueBean�9, 9�, 
> LabelValueBean�10, 10�, LabelValueBean�11, 11�, LabelValueBean�12, 
> 12�, LabelValueBean�13, 13�, LabelValueBean�14, 14��
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: struts-user-help@jakarta.apache.org
> 


__________________________________
Do you Yahoo!?
Yahoo! Mail - More reliable, more storage, less spam
http://mail.yahoo.com

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