This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes Range tag in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Range tag in struts" Watch "Range tag in struts" New topic
Author

Range tag in struts

Rashid Darvesh
Ranch Hand

Joined: Feb 13, 2004
Posts: 189
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

Joined: Apr 14, 2005
Posts: 354
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 ]

-/a<br />certified slacker...yes, my last name is 'do' - <a href="http://www.luckycouple.com" target="_blank" rel="nofollow">luckycouple.com</a>
Rashid Darvesh
Ranch Hand

Joined: Feb 13, 2004
Posts: 189
May i know which tag in JSTL is used to check for this type of condition
alan do
Ranch Hand

Joined: Apr 14, 2005
Posts: 354
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

Joined: Feb 13, 2004
Posts: 189
Thanks
 
wood burning stoves
 
subject: Range tag in struts