aspose file tools*
The moose likes Struts and the fly likes Problems with select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problems with select" Watch "Problems with select" New topic
Author

Problems with select

Giomar Guevara
Ranch Hand

Joined: Oct 18, 2006
Posts: 51
I want to add an option named "Any Value" into a select, apart from the values already contained in an object.
I don't know how to do so...I tried to get the object from the request but it doesn't exist on it,just the "attributeList" object.

this is the select:

<nested:select property="../value" styleId="attributesSelectBoxId" title="Select an option to search attribute" accesskey="D">
<nested ptions property="../possibleValuesAsStringArray"/>
</nested:select>


----------------------------

This is the piece of the jsp where the select is displayed.

<nested resent property="attributeList">
<nested:iterate property="attributeList" indexId="counter">
<tr>
<td valign="middle" align="left" height="20">
<font class="default">
<img src="../images/spacer.gif" width="1"/><span
title="<nested:write property="fullname" />"> <nested:write property="name"/></span>
</font>
</td>
<nested:nest property="attributeType">
<input type="hidden" name="attrib" value="<nested:write property="../attributeId"/>">
<nested:equal property="name" value="single line text area">
<td valign="middle" align="left">
<nested:text property="../value" size="9" title="Enter value attribute" accesskey="T"/>
<input id="<nested:write property="../attributeId"/>" type="hidden" name="matchcase" value="">
</td>
</nested:equal>
<nested:equal property="name" value="multi line text area">
<td valign="middle" align="left">
<nested:text property="../value" size="9" title="Enter value attribute" accesskey="T"/>
<input id="<nested:write property="../attributeId"/>" type="hidden" name="matchcase" value="">
</td>
</nested:equal>
<nested:equal property="name" value="drop down menu">
<td valign="middle" align="left">
<nested:lessThan name="counter" value="5">
<nested:select property="../value" onmouseup="javascript:checkAttrib(this);" styleId="attributesSelectBoxId" title="Select an option to search attribute" accesskey="D">
<nested ptions property="../possibleValuesAsStringArray"/>
</nested:select>
</nested:lessThan>
<nested:greaterEqual name="counter" value="5">
<nested:select property="../value" title="Select an option to search attribute" accesskey="D">
<nested ptions property="../possibleValuesAsStringArray"/>
</nested:select>

</nested:greaterEqual>
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
I do not use the nested tags, so I don't know exactly how they differ from the html tags. The two solutions that I have used for similar behavior are 1) when I populate the list on the form I add an extra entry to the front of the list or 2) in the jsp file just add a htmlption tag before the htmlptionsCollection tag.

- Brent
Giomar Guevara
Ranch Hand

Joined: Oct 18, 2006
Posts: 51
thanks! that worked out...
 
Don't get me started about those stupid light bulbs.
 
subject: Problems with select