Set a default value with the default attribute

Suppose you want to show these anonymous users a message that says, “Hello guest.” This is a perfect place to use a default value with the c:out tag. Just add a default attribute, and provide the value you want to print if your expression evaluates to null:

image with no caption

Or you can do it this way:

<b>Hello <c:out value='${user}'>guest</c:out></b>

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.