In this tutorial you will learn about the JSTL core miscellaneous out tag.
JSTL Core Tag out Example
In this tutorial you will learn about the JSTL core miscellaneous out tag.
<c:out> tag in JSTL is used for inserting the values directly into the output. This tag facilitates you to access the properties using '.' (dot) operator.
Attributes of <c:out> tag
- value : This is a required attribute that is used for providing output information.
- escapeXml : The default value of this attribute is true. The true value defines that the special XML characters should be escapable.
Example :
In the example given below will demonstrate you how to use the JSTL core miscellaneous <c:out> tag in jsp. In this example I am just using the two <c:out> tag and provided the value as a string. So as an output it will simply display the specified two strings in a single line.
JstlCoreTagOutExample.jsp
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <html> <head> <title>JSTL Example</title> </head> <body> <h2>JSTL Core Tag out Example.</h2> <h3>Welcome To <c:out value= "Dev" /> <c:out value= "Manuals" /> </h3> </body> </html>
How to Run this example
Here I am using an IDE Eclipse so I am giving the process of executing this example in perspective of Eclipse. Before executing this example you will have needed to add the following jar files :
- jstl.jar
- standard.jar
After adding of these jar files you may execute your program in the following ways :
- Select JstlCoreTagOutExample.jsp page of your project in Project Explorer -> RightClick -> Run As -> Run On Server -> Choose your server -> Finish.
- On the Eclipse Editor go to your JstlCoreTagOutExample.jsp -> RightClick -> Run As -> Run On Server -> Choose your server -> Finish.
- Go to Run button look at the toolbar in green color and click -> Choose your server -> Finish.
- A simplest way to execute the example in Eclipse is to use the CTRL+F11 key -> Choose your server -> Finish
NOTE : In all of the above execution processes you may start the server first and stop the server each time after the execution if not, each time you will may prompted to a dialog box to Restart the server in Eclipse.
Output :
When the execution process will be completed successfully an output will be displayed on your eclipse browser as :
[ 0 ] Comments