JSTL c:如果是标签条件

时间:2011-12-08 06:51:41

标签: java jstl

<c:if test="${config.update and not config.caseUpdate}">
        <html:submit property="userComments" style="width:200px" styleId="addCommentsBtn">
               <bean:message key="button.update.case"/>
        </html:submit>
</c:if>

我对这种工作机制感到困惑。你能否解释一下条件。

3 个答案:

答案 0 :(得分:1)

这将执行

<html:submit property="userComments" style="width:200px" styleId="addCommentsBtn"> <bean:message key="button.update.case.with.comments"/> </html:submit>

仅当config.update为真且config.caseUpdate为假

例如

<c:if test='condition'> Generate some template text </c:if>

如果条件为真,它将显示模板文本。

如果您想将性别显示为男性,如果条件是性别男性,那么您可以在c:if

中打印男性

有关详情,请查看http://www.exampledepot.com/egs/javax.servlet.jsp.jstl.core/if.html

答案 1 :(得分:0)

Here你可以阅读有关jstl范围和陈述的内容。

答案 2 :(得分:0)

这就像说

if(config.update && !config.caseUpdate){
  show a submit button
}

JSTL也通过检查这些变量是否为空来工作。所以,如果一个为null,它就不会做任何事情。

例如,您可以执行类似

的操作
${config.update}

将对象config.update打印到Web浏览器。如果config.update为null或者在会话中基本上不存在,那么它只是跳过它以便你没有错误。

相关问题