Ternary operator in JSTL/EL

后端 未结 1 1847
迷失自我
迷失自我 2020-12-03 04:10

The following tag of JSTL can be used to set a value to a variable in a request scope.




        
相关标签:
1条回答
  • 2020-12-03 05:03

    I tested the following page in Tomcat 5.59, JSP 2.0 and JSTL 1.1. It ran without any errors.

    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 
    <c:set var="value" scope="request" value="someValue"/>
    <c:out default="None" escapeXml="true" value="${not empty value ? value : 'None'}" />
    <c:out default="None" escapeXml="true" value="${empty value ? 'None' : value}" />
    <c:set var="value" scope="request" value="" />
    <br/>
    <c:out default="None" escapeXml="true" value="${not empty value ? value : 'None'}" />
    <c:out default="None" escapeXml="true" value="${empty value ? 'None' : value}" />
    
    0 讨论(0)
提交回复
热议问题