Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Range tag in struts

 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i have been using struts equal tag to check if a variable is equal to a specific value. What if i want to check a session variable contains a value 4,5,6,7. Right now in logic:Equal i can check only for one value. is there a possibility for checking equal to for multiple values.
Thanks
 
alan do
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is one of the many reasons why i (and many others) moved to JSTL instead of struts-logic and struts-bean libraries. you can try the logic:match tag to do substring matching, but it's not the cleanest/safest approach. one other alternative is to extend the logic:equal tag and do your own custom tag.
[ May 12, 2005: Message edited by: alan do ]
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May i know which tag in JSTL is used to check for this type of condition
 
alan do
Ranch Hand
Posts: 354
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if you have a few values, you can do this...
<c:if test="${theValue == '4' || theValue == '5' || theValue == '6' || theValue == '7'}">
do this...
</c:if>

or you can do range
<c:if test="${theValue >= 4 && theValue <= 7}">
do that
</c:if>
[ May 14, 2005: Message edited by: alan do ]
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic