且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Struts 2中使用if标记?

更新时间:2023-01-07 18:08:59

使用以下代码

<s:if test="#attr.row.Commentaire != null && #attr.row.Commentaire != ''">

if标签使用test属性,将 OGNL 表达式评估为布尔值.

The if tag uses the test attribute to evaluate OGNL expression to a boolean value.

您可能还想使用 a标记呈现HTML锚标记,该标记可以与if标记结合使用

You may also want to use an a tag which renders a HTML anchor tag that could be used combined with the if tag to

咨询财产的内容

consult the contents of the property

还有一个debug标签,可用于包装其他标签,以向您显示将呈现调试数据的链接.

There's also a debug tag that could be used to wrap other tags to show you a link that will render a debug data.

<s:debug>  
 <s:property value="%{#attr.row.Commentaire}"/>
</s:debug>