aspose file tools*
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
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
Author

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

Arun varma
Greenhorn

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
</s:if>
<s:else>
do some calculation
</s:else>
</s:iterator>

David Newton
Author
Rancher

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.)
Douglas
Greenhorn

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.


Sincerely

Douglas
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Unable to test property value in <s:if> tag