• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts - logic:equal and Scriplet question

 
chinnu
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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()%>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic