Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何使用<;s:if>;Struts2中的标签?_Java_Jsp_Struts2_Displaytag_Ognl - Fatal编程技术网

Java 如何使用<;s:if>;Struts2中的标签?

Java 如何使用<;s:if>;Struts2中的标签?,java,jsp,struts2,displaytag,ognl,Java,Jsp,Struts2,Displaytag,Ognl,我有下面的Struts 2标记,我需要检查属性value=“#attr.row.Commentaire是否为空,如果不是,则显示一个小图标,用户可以单击它并查看属性value=“#attr.row.Commentaire的内容 如何有效地使用Struts 2的标记来实现这一点 使用以下代码 <s:if test="#attr.row.Commentaire != null && #attr.row.Commentaire != ''"> 在我的

我有下面的Struts 2标记,我需要检查属性
value=“#attr.row.Commentaire
是否为空,如果不是,则显示一个小图标,用户可以单击它并查看属性
value=“#attr.row.Commentaire
的内容

如何有效地使用Struts 2的
标记来实现这一点


使用以下代码

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

在我的if子句之后,我添加了一个运行良好并显示了一个图标的javascript,如果可以添加javascript,当onclick在图标上显示value=“%{attr.row.Commentaire}”?@john您应该编写
onclick
处理程序并使用
alert(“”)或使用javascript框架将UI小部件应用于处理程序。无论如何,如果您想将值从服务器传递到客户端,混合使用java和javascript是可行的。
<s:debug>  
 <s:property value="%{#attr.row.Commentaire}"/>
</s:debug>