JSTL c:out Core Tag

The JSTL <c:out> Core Tag is used to display the value of an expression to the client’s browser. It works same as of <

Syntax:

<c:out value=”value/expression” />

c:out tag attributes:

Attribute Description Required
value Information to output Yes
default Fallback information to output No
escapeXml True if the tag should escape special XML characters No

Example:

test.jsp

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
 
<html>
  <head>
	<title>c:out JSTL core tag example</title>
  </head>
  <body>
    <c:out value="This is a c:out JSTL core tag example."/><br/>
    Sum of 10 and 20 = <c:out value="${10+20}"/><br/><br/>
 
    <c:out value="${'<h6>This is a <c:out> escape XML test </h6>'}"/>
  </body>
</html>

web.xml

<web-app>
 
  <welcome-file-list>
          <welcome-file>test.jsp</welcome-file>
  </welcome-file-list>	
 
</web-app>

Output:

jsp example 31

Download this example.

Next Topic: JSTL c:set Core Tag with example.
Previous Topic: JSTL Core Tags with example.