File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Struts and the fly likes achieving or condition with logic:equal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "achieving or condition with logic:equal" Watch "achieving or condition with logic:equal" New topic
Author

achieving or condition with logic:equal

Srinivas Rao
Greenhorn

Joined: Aug 05, 2004
Posts: 14
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.
Ergin Er
Ranch Hand

Joined: Sep 06, 2005
Posts: 60
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>
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: achieving or condition with logic:equal
 
Similar Threads
How to use OR condition in Logic Tags
when broswer back button pressed form data is changed.
How to identify that a room is booked?
c:set equivalent in struts tag ?
logic:equal - AND / OR?