Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

checking logic:match for multiple values

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My advice would be to use JSTL for this. Here's an example:

<c:if test='${myForm.prop1 == 'ABC' || myForm.prop1 == "XYZ"}'></c:if>
 
Ranch Hand
Posts: 261
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the jstl
<%@taglib uri="http://java.sun.com/jstl/core"; prefix="c"%>



or did u mean this

 
Jaya Swaminathan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
This guy is skipping without a rope. At least, that's what this tiny ad said:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic