Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Arun varma
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic