Struts Logic:equal problem compairing bean values
843838Jan 16 2006 — edited Sep 4 2007I have two seperate beans available to a .jsp. I am trying to set the "selected" value of a Select option tag to "true" if the value of bean 1 equals the value of bean 2.
Code as below:
---------------------------------------------------------------------
<logic:present name="SActionForm" scope="request">
<bean:define id="SActionForm" name="SActionForm" scope="request"/>
</logic:present>
...
...
...
<select name="category" id="category">
<logic:iterate id="category" name="categoryList" type="uk.co.test.scr.bom.Category" scope="session">
<option value='<bean:write name="category" property="category_id"/>'<logic:equal name='category' property='category_id' value='<bean:write name="SActionForm" property="category"/>'> selected='true'</logic:equal>>
<jsp:getProperty name="category" property="category_description"/>
</option>
</logic:iterate>
</select>
-------------------------------------------------------------
I've checked the values match by printing out the bean values during each iteration, therfore I think it a problem specific to the logic:equal statement:
<logic:equal name='category' property='category_id' value='<bean:write name="SActionForm" property="category"/>'> selected='true'</logic:equal>
Anyone any ideas????
Thanks in advance