File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes How to check value in list using s:if Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "How to check value in list using s:if" Watch "How to check value in list using s:if" New topic

How to check value in list using s:if

shwetank sharma

Joined: Jan 09, 2011
Posts: 10

Hi All,

I have set an arraylist in session

Now i want to check for some value in that list and then only display the link.

The approach which is working is to iterate the list in session and check for that value

for eg,

but i need to check value and show link many a times so iterating everytime over same object doesn't looks good...moreover i also cannot use many time <s:if> for each check within iterator due to design constraint..

what i was looking was something like if i can directly use if without iterator

but this approach isn't working...

Looking forward for your inputs..

Thanks in advance..


Joe Ess

Joined: Oct 29, 2001
Posts: 9189

OGNL never clicked with me, so whenever I find myself with a complex condition that I'd like to use in an if tag, I make the condition a property of the action. Then the OGNL for the if tag is simple and I can evaluate the condition in easy-to-understand Java.

[How To Ask Questions On JavaRanch]
It is sorta covered in the JavaRanch Style Guide.
subject: How to check value in list using s:if
It's not a secret anymore!