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

Struts - logic:equal and Scriplet question

chinnu
Greenhorn

Joined: Sep 07, 2005
Posts: 3
I have a.jsp in which i include b.jsp

In a.jsp the bean is defined,

<bean efine id="supBean" name="detForm"
property="superior" type="com.abc.asds.object.Superior"/>


There is a property 'superiorCode ' which is a String in class "Superior".

In b.jsp i wanted to compare this 'superiorCode ' property with another string. It is not just one string
but multiple strings to be compared.

So i called logic:equal as follows.

<logic:equal name="supBean" property="'superiorCode " value="<%= sup_more %>" >

it is fine and it is comparing the value.

But i wanted the comparison as:

if((superiorCode == sup_more ) || (superiorCode == sup_less ))

Question 1:

Is it possible with struts ?


Question 2:

'superiorCode ' property which i am getting above in struts - logic tag wanted to get the same property in
a scriplet. Not able to retreive the property.

Can anyone provide the syntax to retreive the value.


Thanks a lot.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Question 1:
Whether this is possible using Struts tags, I don't really know, but I'd suggest using JSTL:
<c:if test="${(superiorCode == sup_more ) || (superiorCode == sup_less )
}" >
</c:if>

Question 2:

<%=supBean.getSuperiorCode()%>


Merrill
Consultant, Sima Solutions
 
Consider Paul's rocket mass heater.
 
subject: Struts - logic:equal and Scriplet question