• 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

achieving or condition with logic:equal

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to check for 'OR' condition in Struts. For example, if the status is 1 or 2, I have to show a bunch of code. So far I am using 2 blocks of logic:equal and copying the whole bunch of code. The problem with this approach is if I want to check many 'OR' conditions, difficult to maintain.

If I have to check many 'OR' conditions, I am doing all these checks in Action class and setting the result to another form variable and comparing these new variable in JSP. But this leads to additional(unnecessary) properties in the Form bean.

What is the best approach to achieve the above condition.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you can have 2 diiferent values for an attribute u can use this one I think.
<logic:equal name="FormBean" property="Attribute" value="${valuex || valuey}">

If u want to do a compare on 2 attributes than I would suggest to use <c:if>
reply
    Bookmark Topic Watch Topic
  • New Topic