Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Struts Logic:equal problem compairing bean values

843838Jan 16 2006 — edited Sep 4 2007
I 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
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 2 2007
Added on Jan 16 2006
14 comments
860 views