I have a problem in accessing a collection (String array) that is in a form
bean when is use <html:options> tag. Say, I have AddressForm, which has
"name" (String) and "address" (String) as members. After my action servlet
puts an array of the AddressForm in a request object (named as
"r_addresses"), all the address list can be displayed in a JSP table as:

<logic:iterate id="ad" type="com.[fullpath].AddressForm" name="r_addresses">
<tr>
<td>
<bean:write name="ad" property="name"/>
</td>
<td>
<bean:write name="ad" property="address"/>
</td>
</tr>
</logic:iterate>

This is just fine. Now, I have another AddressForm member of a string array
for multiple phone numbers, as "phones" (String[]) and need to display as a
dropdown in the table. All I could do was as follows:

<logic:iterate id="ad" type="com.[fullpath].AddressForm" name="s_addresses">
<tr>
<td>
<bean:write name="ad" property="name"/>
</td>
<td>
<bean:write name="ad" property="address"/>
</td>
<td>
<!-- Phone dropdown -->
<bean:define id="telephones" property="phones" scope="request"/>
<html:select property="phonelist">
  <html:options collection="telephones" property="digits"
labelProperty="number"/>
<html:select>
<!-- ----------------->
</td>
</tr>
</logic:iterate>

I'm using Struts 1.1b and Tomcat 4.0.4. Some document said the bean:define
tag should cache the member string array so the html:options simply can
refer to it. But with this code, the JSP page stops outputting HTML codes
without any error. If anyone could give me any suggestion on this, that
would be great.

Masaki Itagaki   


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


Reply via email to