I am facing an issue in struts 1.2

This code is in my JSP file. I am using multi select option. Initially the values will be populated to the multi select box from database through LabelValueBean. While I select one or more options and click submit, the values are retrieved in action class as empty string instead of its corresponding label and value.

Please share your advise..

<td class="td1" valign="top" colspan="1">Service options:  </td>
<td class="td2" colspan="2">
<html:select property="selectedServices" name="specificStoreForm" multiple="true" styleClass="services">
<logic:iterate id="service" name="services">
<html:option value="">                                       
<bean:write name="service" property="label"/>
<bean:write name="service" property="value"/><br/>                                                                        

The other fields in the JSP like checkbox, textbox values are obtained in the action class.

somehow I found the rootcause for this issue. <html:option value=""> was the problem. So, I was getting empty string in the for the form bean in action class.

I tried to fix this in two ways:

<bean:define id="optionsValue" name="service" property="value"/>
                                    <html:option value="optionsValue">
                                        <bean:write name="service" property="label"/>


<html:option value="<bean:write name="service" property="value"/>">
                                        <bean:write name="service" property="label"/>

But both these options are not producing the value for the particular option.

Please share your advice!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.