File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes Unable to test property value in <s:if> tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Unable to test property value in <s:if> tag" Watch "Unable to test property value in <s:if> tag" New topic

Unable to test property value in <s:if> tag

Arun varma

Joined: Mar 21, 2004
Posts: 9
I have a iterator tag which iterate on a list say Employees. Employees list contains object of Class Employee. Employee class has a boolean field resigned. I have a condition on resigned attribute say if resigned == true then show employee resigned details and if resigned == false then i need to show employee details.

How to evaluate the property value ?.

<s:iterator value="myList">
<s:if test="<s:property value="resigned">" == 'true'>
do some calculation
do some calculation

David Newton

Joined: Sep 29, 2008
Posts: 12617

Please UseCodeTags when posting code or configuration. Unformatted code and configuration is very difficult to read. You can edit your post to include them by using the button.

You can't nest tags like that; that's not valid JSP. Have you read the Struts 2 documentation? Particularly regarding OGNL and how to use expressions in the S2 tags?(If it's actually a boolean as you said in the first paragraph, which your code contradicted.)

Joined: Jul 10, 2002
Posts: 1
Hello guys,
I was just passing by and some remarks got my attention and make me stop right here.
I would love to tell you that for us to help someone out with questions, doubts or whatever it is, it is not necessary to humiliate people for something they might do wrong.
We are all technical people and we all can make mistakes. So I suggest you next time we help someone out in this forum to do it with respect.


I agree. Here's the link:
subject: Unable to test property value in <s:if> tag
It's not a secret anymore!