Struts2 s:if test for non-null value

前端 未结 1 1524
予麋鹿
予麋鹿 2021-01-17 07:23

I am wanting to test for a non-null value using a struts2 tag. This works if I use the following:

..stuff..&l         


        
相关标签:
1条回答
  • 2021-01-17 07:50

    Using <s:if test="whatsoever the whatsoever is an OGNL expression that should evaluate to Boolean value if you want the tag is working right. If your field is of boolean type it's ok, in other case it's just doesn't work.

    Also, in the documentation page for the if tag the type is defined as Boolean, so it's not primitive boolean but the value could be primitive boolean. So, be careful when using different types when evaluating the test case.

    0 讨论(0)
提交回复
热议问题