• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts - logic:equal and Scriplet question

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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()%>
 
reply
    Bookmark Topic Watch Topic
  • New Topic