簡體   English   中英

JSTL c:if標簽條件

[英]JSTL c:if tag condition

<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>

我對這種工作機制感到困惑。 您能否解釋一下條件。

這將執行

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

僅當config.update true和config.caseUpdate false時

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

如果為true,則將顯示模板文本。

如果您想將性別顯示為男性(如果條件是性別),則可以在c:if中打印男性

有關更多信息,請訪問http://www.exampledepot.com/egs/javax.servlet.jsp.jstl.core/if.html

在這里,您可以了解有關jstl范圍和語句的信息。

這就像在說

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

JSTL還可以通過檢查那些變量是否為null來工作。 因此,如果一個為null,它將不會做任何事情。

例如,您可以做類似的事情

${config.update}

以將對象config.update打印到Web瀏覽器。 如果config.update為null或會話中基本不存在,則它會跳過它,因此不會出現任何錯誤。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM