Home Jsp Simple-jsp-example For Simple Calculation and Output
Questions:Ask|Latest

 
 

Share on Google+Share on Google+

For Simple Calculation and Output

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

<c: out> For Simple Calculation and Output

        

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 of <c: out>. The attribute value which is a must attribute and by using this attribute we are calculating the sum of numbers and displaying the output on the browser. 

The code of the program is given below:

 

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head>
<title>Adding numbers by using c: out</title>
</head>

<body>
<h1>Adding numbers by using c: out</h1>

10 + 20 + 30 = 
<c:out value="${10 + 20 + 30}" /><br>
</body>
</html>

The output of the program is given below:

Download this example.

 

Advertisement

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: March 12, 2008

Related Tutorials

Ask Questions?    Discuss: For Simple Calculation and Output  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments
DMCA.com