开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜