Meaningless Drivel is fun!*
The moose likes Struts and the fly likes checking logic:match for multiple values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "checking logic:match for multiple values" Watch "checking logic:match for multiple values" New topic
Author

checking logic:match for multiple values

Jaya Swaminathan
Greenhorn

Joined: Jul 19, 2005
Posts: 17
Hi, I want to display a portion of the HTML if one form parameter has either of two values. I could use logic:match or logic:equal to check against one constant value. But I am not sure how i could check whether it is equal to either of the two values. Any help would be appreciated.
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
My advice would be to use JSTL for this. Here's an example:

<c:if test='${myForm.prop1 == 'ABC' || myForm.prop1 == "XYZ"}'></c:if>


Merrill
Consultant, Sima Solutions
Pranav Sharma
Ranch Hand

Joined: Oct 27, 2003
Posts: 258
use the jstl
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>



or did u mean this

Jaya Swaminathan
Greenhorn

Joined: Jul 19, 2005
Posts: 17
Hi, Thanks for ur response. I could not use JSTL because we are using older version of JSP and i cant upgrade.

So I did this. I set a form attribute to true(used it as a flag) if the value is either of the two options and then used the logic:equal to check that the flag is set or not. It worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: checking logic:match for multiple values
 
Similar Threads
jsp:param usage
select a radio button
Detecting browser
jsp:param usage
Disabling a h:commandLink