in JSTL

One of the general purpose core library tag is . The main function of the this tag is to display the output to the user.

Ads

<c: out> in JSTL

        

One of the general purpose core library tag is <c: out>. The main function of the this tag is to display the output to the user. It works like expression tag in jsp <%= ---%>. 

Attributes of the <c: out> core action tag. 

  1. value: It specify the expression which needs to be evaluated. 
  2. default: We can use this attribute if the resulting value is null.
  3. escapeXml: It checks whether there is any need to convert the &, <, > etc to their character encoding codes. 

In this example we have used only one attribute i.e. value. It is a must attribute in the tag. We are just calculating the multiplication of two numbers by using the <c: out> core action tag.

The code of the example is given below:

 

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<html>
<head>
<title>Simple Calculation by using c: out</title>
</head>
<body bgcolor="#FFFFCC">
<h1>Simple Calculation by using c: out</h1>

<%-- Multiplying the numbers 2 * 3 dynamically --%>
2 * 3 = <c:out value="${2 * 3}" />

</body>
</html>

The output of the program is given below:

Download this example.

 

Advertisements

Ads
Share on Google+Share on Google+

in JSTL

Posted on: March 12, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: in JSTL  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:2
kim
March 20, 2012
i don't understand <c:out>example

2 * 3 = <c:out value="${2 * 3}"/> 2 * 3 = <c:out value="${2 * 3}" escapeXml="false"/> <br> 2 * 3 = <c:out value="${2 * 3}" escapeXml="true"/> all result same! what <c:out>tag default value? please send this email another example
Gunith
November 8, 2012
Tag name is wrong

Should be corrected as <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

Ads

 

Ads