Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

struts 2 s:if test tag

 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, I am having some problems getting the syntax correct for an if tag test. I set a String called status in my action that will have a value of "inactice" or "active". I try to test this in my jsp with the following code that does not even render on the page?

Can someone tell me what I am doing wrong here?

<s:if test="%{#status == 'inactive'}">
write something
</s:if>
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Make sure that you have a getStatus and setStatus method in your Action class. Then just remove the "#" from the expression, and it should work:
 
Katie Doody
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works now, thanks!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic