JSP <c:out/> - The default attribute doesn't work?
I'm having tr开发者_运维问答ouble with the default attribute of the JSP/JSTL tag . The value given for the default-attribute is not displayed.
<% @ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:out value='value' default="defaultValue"/>
=> Displays value
<c:out value='' default="defaultValue"/>
=> Displays nothing.. // Should have been defaultValue
Why doesn't this work?
First, you'd better use double-quotes ("
).
Then, ""
is a value - it is an empty string. The default value is used when the value is null
精彩评论