JavaBeat

  • Home
  • Java
    • Java 7
    • Java 8
    • Java EE
    • Servlets
  • Spring Framework
    • Spring Tutorials
    • Spring 4 Tutorials
    • Spring Boot
  • JSF Tutorials
  • Most Popular
    • Binary Search Tree Traversal
    • Spring Batch Tutorial
    • AngularJS + Spring MVC
    • Spring Data JPA Tutorial
    • Packaging and Deploying Node.js
  • About Us
    • Join Us (JBC)
  • Privacy
  • Contact Us

JSTL Core c:remove Tag

February 20, 2014 by Krishna Srinivasan Leave a Comment

The <c:remove> tag is used to remove the variable from the specified scope. If we want to remove the variable from the scope we need to specify the scope if we not specify the scope then it will remove the variables from all scopes.

Syntax For <c:remove> Tag

[code lang=”html”]
<c:remove var=”string” scope=”string”/>
[/code]

Attributes of <c:remove> Tag

  • var: This attribute specify the name of the variable which is to be removed.
  • scope: This attribute specify scope of the variable where the variable can be removed.

Example of <c:remove> Tag

[code lang=”html”]</pre>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="UTF-8"%>
<!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>
<h3>JSTL Core Tag remove Example.</h3>
<c:set var="str" value="JavaBeat.net"/>
<h4>Values assigned for the string is </h4>
<b>Value of str : </b><c:out value= "${str}" /><br>
<!– Removing the value associated to variable str1 –>
<c:remove var="str"/>
<h4>After Removing the values from the string </h4>
<b>Value of str is null: </b><c:out value="${str}" /><br>
</body>

</html>
[/code]

Steps for Execution

  • Save this file as example.jsp in your eclipse IDE.
  • Now select this jsp file, right mouse click and select Run as ->Run on server

Output

When the execution process is completed successfully we will get the following output :
JSTL core c remove tag_demo

Previous Tutorial : JSTL Core c:import  :: Next Tutorial : JSTL Core c:forEach Tag

Filed Under: Java EE Tagged With: JSTL Tutorials

JSTL Core c:import Tag

February 18, 2014 by Krishna Srinivasan Leave a Comment

The <c:import> tag is used to include the content of another resource in the current JSP. The resource can be either static or dynamic. The <c:import> tag works like the but it is more flexible and powerful.

The syntax of <c:import> tag is as follows

[code lang=”html”]
<c: import attributes> </c:import>
[/code]

The attributes of <c:import> Tag

  • url: This is the major attribute in the tag and its mandatory attribute. This attribute is used to retrieve and import into the page. This specifies URL of the source to include.
  • var: This is optional attribute. This is used to specifies the name of the variable into which the result has to be stored, if specifies. If this is not specifies then the imported data will be printed on the current page.
  • scope: This is also optional attribute. This attribute is used to specifies the scope into which the variable has to be stored. If we are using var attribute then only we can use the scope attribute.
  • context: This attribute is used to specify the context name in which the page has to be located.

Example of <c:import> Tag

Listing 1:example.jsp

[code lang=”html”]
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
<h3>test.html</h3>
<div style="border: 10px solid red;">
<c:import var="testHtml" url="/test.html" />
<c:out value="${testHtml}" escapeXml="false" />
</div>
<h3>test.html source code</h3>
<c:import var="testHtmlSource" url="/test.html" />
<c:out value="${testHtmlSource}" escapeXml="True" />
[/code]

Html files for the above program is as follows:

Listing 2:test.html

[code lang=”html”]</pre>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Test Page</title>
</head>
<body>
This is the Test page
</body>
</html>
[/code]

How To Run?

  • Save this file as example.jsp in your eclipse IDE.
  • Now select this jsp file, right mouse click and select Run as ->Run on server

Output

When the execution process is completed successfully we get the following output:
JSTL_c import tag_demo

Previous Tutorial : JSTL Core c:choose,  c:when, c:otherwise Tags :: Next Tutorial : JSTL Core c:remove Tag

Filed Under: Java EE Tagged With: JSTL Tutorials

JSTL Core c:choose, c:when, c:otherwise Tags

February 18, 2014 by Krishna Srinivasan Leave a Comment

JSTL Core <c:choose> Tag

The <c:choose> tag of JSP core tag library is used for conditional execution of statement. The choose tag is used to construct an <c:if> statement. The <c:choose> tag acts like a java switch statement. The <c:choose> tag executes the conditional block statements which is embedded with the sub-tags <c:when> and <c:otherwise>.

The syntax of <c:choose> Tag

[code lang=”html”]
<c:choose> body content </c:choose>
[/code]

The <c:choose> tag has no attribute.

JSTL Core <c:when> Tag.

It is a subtag of <c:choose> tag .<c:when> tag is like the block of if control statements which executes when the condition is true. The <c:when> tag encloses a single case within the <c:choose> tag.

The syntax of <c:when> Tag

[code lang=”html”]
<c:when attribute> body content </c:when>
[/code]

Attribute used in <c:when> Tag

There is only one attribute used in the <c:when> tag that is test. test attribute is used to provide conditional statement for evaluation.

JSTL Core <c:otherwise> Tag

<c:otherwise> tag is similar to default statement which works when all the statements of <c:otherwise> holds false. This tag is like else of if control statement of java program.This is also a subtag of <choose> tag .
The <c:otherwise> tag is evaluated if <c:when> or nested <c:when> tag attribute test condition is not evaluated to true.

syntax of <c:otherwise> Tag

[code lang=”html”]
<c:otherwise> body content </c:otherwise>
[/code]

The body content of the <c:otherwise> tag is evaluated if none of the <c:when> conditions in the <c:choose> tag are resolved to true. There is a no attribute for <c:otherwise> tag.

Example using <c:choose>, <c:when> and <c:otherwise> Tags

[code lang=”html”]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
<span style="font-size: 12px; line-height: 18px;"> pageEncoding="ISO-8859-1"%></span>
<span style="font-size: 12px; line-height: 18px;"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" </span>
<span style="font-size: 12px; line-height: 18px;">"http://www.w3.org/TR/html4/loose.dtd"></span>
<span style="font-size: 12px; line-height: 18px;"><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %></span>
<span style="font-size: 12px; line-height: 18px;"><html></span>
<span style="font-size: 12px; line-height: 18px;"><head></span>
<span style="font-size: 12px; line-height: 18px;"><title>c:choose, c:when and c:otherwise Tag Example</title></span>
<span style="font-size: 12px; line-height: 18px;"></head></span>
<span style="font-size: 12px; line-height: 18px;"><body></span>
<span style="font-size: 12px; line-height: 18px;"><c:set var="number1" value="${6546}"/></span>
<span style="font-size: 12px; line-height: 18px;"><c:set var="number2" value="${12}"/></span>
<span style="font-size: 12px; line-height: 18px;"><c:set var="number3" value="${10}"/></span>
<span style="font-size: 12px; line-height: 18px;"><c:choose></span>
<span style="font-size: 12px; line-height: 18px;"> <c:when test="${number1 < number2}"></span>
<span style="font-size: 12px; line-height: 18px;"> ${"number1 is less than number2"}</span>
<span style="font-size: 12px; line-height: 18px;"> </c:when></span>
<c:when test="${number1 <= number3}">
<span style="font-size: 12px; line-height: 18px;"> ${"number1 is less than equal to number2"}</span>
<span style="font-size: 12px; line-height: 18px;"> </c:when></span>
<span style="font-size: 12px; line-height: 18px;"> <c:otherwise></span>
<span style="font-size: 12px; line-height: 18px;"> ${"number1 is largest number!"}</span>
<span style="font-size: 12px; line-height: 18px;"> </c:otherwise></span>
<span style="font-size: 12px; line-height: 18px;"></c:choose></span>
<span style="font-size: 12px; line-height: 18px;"></body></span>
<span style="font-size: 12px; line-height: 18px;"></html></span>
[/code]

How To Run?

  • Save this file as example.jsp in your eclipse IDE.
  • Now select this jsp file, right mouse click and select Run as ->Run on server

Output

When the execution process is completed successfully we will get the following output :
jstl_core c choose tag_demo

Above example demonstrate the use of <c:choose>, <c:when> and <c:otherwise> tags. In the above example we used the <c:set> tag first for assigning the value for variables and the we use the <c:when> and <c:otherwise> tags. These tags are sub tags of <c:choose>. These tags execute the the conditional statements specified by the <c:when test=””>.
Above example demonstrate the comparisons between three numbers and displays the greater number.

 

Previous Tutorial : JSTL Core c:if Tag :: Next Tutorial : JSTL Core c:import Tag

Filed Under: Java EE Tagged With: JSTL Tutorials

JSTL Core c:if Tag

February 18, 2014 by Krishna Srinivasan Leave a Comment

The <c:if> tag is the most useful of tags of JSTL core tag library. This tag evaluates an expression and displays its body content only if the expression is true. This tag allows test for condition, condition like checking for particular parameters in requestScope, sessionScope or pageScope.

Syntax For c:if Tag

[code lang=”html”]
<c:if attribute> body content </c:if>
[/code]

Attribute In c:if Tag

  • test: This condition determines whether or not the body content should be processed.
  • var: Name of the exported scoped variable for the resulting value of the test condition. The type of the scoped variable is Boolean.
  • scope: Scope of the variable to store the condition’s result.

Example of c:if Tag

[code lang=”html”]
<%@ 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" %>
<span style="font-size: 12px; line-height: 18px;"><html></span>
<span style="font-size: 12px; line-height: 18px;"><head></span>
<span style="font-size: 12px; line-height: 18px;"><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"></span>
<span style="font-size: 12px; line-height: 18px;"><title>JSTL If Tag Example</title></span>
<span style="font-size: 12px; line-height: 18px;"></head></span>
<span style="font-size: 12px; line-height: 18px;"><body></span>
<span style="font-size: 12px; line-height: 18px;"> <c:set var="weight" value="92"></span>
<span style="font-size: 12px; line-height: 18px;"> </c:set></span>
<span style="font-size: 12px; line-height: 18px;"> <c:if test="${weight != null}"></span>
<span style="font-size: 12px; line-height: 18px;"> Weight of the product is ${weight * 0.453592} kgs. </span>
<span style="font-size: 12px; line-height: 18px;"> </c:if> </span>
<span style="font-size: 12px; line-height: 18px;"></body></span>
</html>
[/code]

How To Run?

  • Save this file as example.jsp in your eclipse IDE.
  • Now select this jsp file, right mouse click and select Run as ->Run on server

Output

When the execution process is completed successfully we will get the following output :
jstl_core c if tag_demo

Previous Tutorial : JSTL Core c:catch Tag :: Next Tutorial : JSTL Core c:choose,  c:when, c:otherwise Tags

Filed Under: Java EE Tagged With: JSTL Tutorials

JSTL Core c:catch Tag

February 18, 2014 by Krishna Srinivasan Leave a Comment

<c:catch> tag is used to handle the exceptions that can be raised by any of the tag which are located inside the body of the tag. The tag <c:catch> is member of core tag library of jstl.

The <c:catch> tag catches any throwable that occurs in the body of the tag. This tag is used to handle exception during run time.

Syntax For c:catch Tag

[code lang=”html”]
<c:catch> attributes> body content </c:catch>
[/code]

The tag accepts the var attribute, which takes the name of the variable that stores the exception thrown.

Example of c:catch Tag

[code lang=”html”]
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<span style="font-size: 12px; line-height: 18px;"><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" </span>
<span style="font-size: 12px; line-height: 18px;">"http://www.w3.org/TR/html4/loose.dtd"></span>
<span style="font-size: 12px; line-height: 18px;"><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %></span>
<span style="font-size: 12px; line-height: 18px;"><html></span>
<span style="font-size: 12px; line-height: 18px;"><head></span>
<span style="font-size: 12px; line-height: 18px;"><%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%></span>
<span style="font-size: 12px; line-height: 18px;"><html></span>
<span style="font-size: 12px; line-height: 18px;"><head></span>
<span style="font-size: 12px; line-height: 18px;"><title>JSTL c:catch Example</title></span>
<span style="font-size: 12px; line-height: 18px;"></head></span>
<span style="font-size: 12px; line-height: 18px;"><body></span>
<c:catch var="CatchNullPointerException">
<span style="font-size: 12px; line-height: 18px;"> <% String str = null; str.trim(); %></span>
</c:catch>
<c:if test="${CatchNullPointerException != null}">
<p>
Exception is : ${CatchNullPointerException} <br />
</p>
</c:if>
</body>
</html>
[/code]

How To Run?

  • Save this file as example.jsp in your eclipse IDE.
  • Now select this jsp file, right mouse click and select Run as ->Run on server

Output

When the execution process is completed successfully we will get the following output :
jstl_c catch tag_demo

Advantages of c:catch Tag

  • It is used to handle exception generated during run time.
  • This tag is used to capture any throwable exception that happens on the body of a page.

Previous Tutorial : JSTL Core Out Tag :: Next Tutorial : JSTL Core c:if Tag

Filed Under: Java EE Tagged With: JSTL Tutorials

JSTL Core c:out Tag

February 15, 2014 by Krishna Srinivasan Leave a Comment

The <c:out> tag is used to print or display the result of an expression. This tag is also used for getting output for the user. It works like expression tag in jsp <%=…..%>. This uses the simpler notation as “.” to access properties.

Syntax of <c:out> tag

[code lang=”html”]
<c:out attribute> body content </c:out>
[/code]

Attributes used for <c:out> tag

  • Value: This attribute is used to specify the expression which has to be evaluated.
  • Default: This is optional attribute this attribute used when the resulting value is null.
  • escapeXml: This is also an optional attribute it used to check whether there is need to convert XML characters like &,’,”,<,> etc to their character encoding codes.Default value is true

Example of <c:out> tag

[code lang=”html”]</pre>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<span style="font-size: 12px; line-height: 18px;"><title>Example of c:set</title></span>
<span style="font-size: 12px; line-height: 18px;"></head></span>
<span style="font-size: 12px; line-height: 18px;"><body>Setting value using c:set </span>
<span style="font-size: 12px; line-height: 18px;"><c:set var="name" scope="request" value="Welcome to JavaBeat" /><br></span>
<span style="font-size: 12px; line-height: 18px;">Value is: <b><c:out value="${name}"/></b><br></span>
</body>
<span style="font-size: 12px; line-height: 18px;"></html></span>
<pre>
[/code]

Steps for Execution

  • Save this file as example.jsp in your eclipse IDE.
  • Now select this jsp file, right mouse click and select Run as ->Run on server

Output

When the execution process is completed successfully we will get the following output :
jstl_couttag_demo

Previous Tutorial : JSTL Core Set Tag :: Next Tutorial : JSTL Core c:catch Tag

Filed Under: Java EE Tagged With: JSTL Tutorials

JSTL Core c:set Tag

February 15, 2014 by Krishna Srinivasan Leave a Comment

The <c:set> tag is general purpose tag which allows to set the value of a variable or property into the given scope. Using this tag we can set the property of bean and also we can set the values of map. This tag sets the result of an expression evaluation based on the value of the attributes.

Syntax of <c:set> tag

[code lang=”html”]
<c:set attribute> body content </c:set>
[/code]

Attribute of <c:set> tag

  • value: This attribute is used to save the information. The values of <c:set> tag can be given in the body of the tag instead of an attribute line.
  • var: This attribute is used to display the name of the variable to store the information.
  • property: This attribute is used to modify the property of the variable.
  • target: This attribute is used to show name of the variable whose property should be modified.
  • scope: This attribute specifies the scope of variable to store information.

Example of <c:set> tag

[code lang=”html”]
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Example of c:out JSTL</title>
</head>
<body>
<h3>An Example of c:out JSTL…</h3><br/>
Welcome to JavaBeat.net <b> <c:out value="${name}"/></b>
</body>
</html>
[/code]

Steps for Execution

  • Save this file as example.jsp in your eclipse IDE.
  • Now select this jsp file, right mouse click and select Run as ->Run on server

Output

When the execution process is completed successfully we will get the following output :
jstl_csettag_demo

Previous Tutorial : JSTL Core Tags :: Next Tutorial : JSTL Core Out Tag

Filed Under: Java EE Tagged With: JSTL Tutorials

JSTL Core Tags Library

February 15, 2014 by Krishna Srinivasan Leave a Comment

The Core tag library is the collection of the JSTL core tags in the JSP pages. These tags are used for manipulating data in JSP pages. This is used for iterating on data collection, setting parameter etc.

The Syntax for the JSTL Core Tag

[code lang=”html”]
<% @taglib uri= “http://java.sun.com/jsp/jstl/core” prefix= “c” %>
[/code]

Prefix c is used to refer to this tag in the jsp.

JSTL Core Tags

The JSTL core tags can be categorized based on their functions as below:

  • Variable support– This category includes tags like remove,set
  • Flow control– This category includes tags like choose, when,otherwise,forEach,forTokens,if
  • URL management– This category includes tags like import,redirect,url
  • Miscellaneous– This category includes tags like catch,out

Each of these tags are explained below:

  • <c:out> – The c:out tag is used to print or display the result of an expression.
  • <c:set> – This tag is used to set the value of variable into the given scope.
  • <c:remove> – The c:remove tag is used to remove the variable from the specified scope.
  • <c:catch> – c:catch tag is used to handle the exceptions that can be raised by any of the tag which located inside the body of the <catch> tag.
  • <c:if> – This tag evaluates an expression and displays its body content only if the expression is true.
  • <c:choose> – The <c:choose> tag executes the conditional block statements which is embedded with the sub-tags <c:when> and <c:otherwise>.
  • <c:when> – The <c:when> tag is like the block of if control statements which executes when the condition is true.
  • <c:otherwise> – The <c:otherwise> tag is evaluated if when or nested when tag attribute test condition is not evaluated to be true.
  • <c:import> – The <c:import> tag is used to include the content of another resource in the current JSP.
  • <c:forEach> – The <c:forEach> tag is used to iterate over a collection of data such as arrays.
  • <c:forToken> – The <c:forToken> tag is used to break a string into tokens and iterate through each of the tokens.
  • <c:param> – The <c:param> tag add the parameter and their values to the output of <c:url> and <c:redirect> tag.
  • <c:redirect> – It is used to redirect control to other pages within the web application.
  • <c:url> – The <c:url> tag formats a URL into a string and stores it into a variable.

Next tutorials explains each tag in detail.

Previous Tutorial : What is JSTL Tags?  ::  Next Tutorial : JSTL Core c:set Tag

Filed Under: Java EE Tagged With: JSTL Tutorials

What is JSTL Tags and How to Setup?

February 15, 2014 by Krishna Srinivasan Leave a Comment

JSTL stand for JavaServer Pages Standard Tag Library. JSTL provides a framework for integrating custom tags with JSTL tags. The goal of JSTL is to minimize or, if possible, eliminate actual Java code introduced through JSP. JSTL is a collection of very useful core tags and functions. These tags and functions will help you write JSP code efficiently. These tags allow developers to use predefined tags instead of writing the java code. This also provides core iteration and control flow features, text inclusion and SQL tags.

Types of JSTL Tags

JSTL provides four types of tag libraries. They are as follows:

  • JSTL core tags: These tags are used for manipulating with data in JSP pages. This is used for iterating on data collection, setting parameter etc.
  • The XML tag library: This tag is used for manipulating XML documents. These tags are used for parsing, selecting and transforming XML data in JSP page.
  • The Format tag library: These tags are used for formatting the data used in a JSP page.
  • The SQL tag library: This library is used to access the relational database used in a JSP page.

Advantages of JSTL

  1. JSTL represents the new method of programming web pages.
  2. JSTL is used to separate the business logic from the design logic.
  3. It is used to encapsulate the data
  4. JSTL is a great tool for performing tasks such as iterating over relatively simple data structures and similar tasks.

Disadvantages of JSTL

  1. JSP files that make use of JSTL will generate a great deal of overhead code.
  2. JSTL is not flexible JSTL is a new programming language that’s the reason it is not popular as like java
  3. May seem burdensome for experienced programmers

Environment to set up for JSTL

Following steps are useful for setup the JSTL Library:
You would need the following jars to use JSTL:

  • JSTL1.2.jar: Download this from http://search.maven.org/#browse. Go to jstl/ directory on the this link and download the latest jstl.jar
  • standard.jar:Download this from http://search.maven.org/#browse. Go to taglibs/ directory on the this link and download the latest standard.jar/

Copy these two jar files to WEB-INF/lib directory of your web server, in our case it is Tomcat 7.0.50. To start using JSTL in your JSP, it is necessary to declare taglib using proper URI path. Following tags are used in JSP

[code lang=”html”]
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
[/code]

JSTL Version

The latest version of JSTL is JSTL 1.2. We are using the same version of JSTL for demonstrate the use of JSTL in all our examples.

Simple Example of JSTL

[code lang=”html”]
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
<span style="font-size: 12px; line-height: 18px;">"http://www.w3.org/TR/html4/loose.dtd"></span>
<span style="font-size: 12px; line-height: 18px;"><%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %></span>
<span style="font-size: 12px; line-height: 18px;"> Simple Example Of JSTL<br><br></span>
<span style="font-size: 12px; line-height: 18px;"><c:out value="Wecome To JSTL"/></span>
[/code]

In the above example first taglib directive points to the JSTL core tag library with prefix “c”. <c:out> tag is used to print or display the result of an expression.

Steps for Execution

  • Click on the jsp File.
  • Right click on mouse and select run as ->click run on server.
  • The simple way for execute the program on eclipse is to use Ctrl+F11 key then click on select your browser option and click on finish.

Output

When the execution process is completed successfully we will get the output as below:
jstl_simpleprogram_demo

 

Next Tutorial : JSTL Core Tags

Filed Under: Java EE Tagged With: JSTL Tutorials

  • « Previous Page
  • 1
  • …
  • 4
  • 5
  • 6

Follow Us

  • Facebook
  • Pinterest

As a participant in the Amazon Services LLC Associates Program, this site may earn from qualifying purchases. We may also earn commissions on purchases from other retail websites.

JavaBeat

FEATURED TUTORIALS

Answered: Using Java to Convert Int to String

What is new in Java 6.0 Collections API?

The Java 6.0 Compiler API

Copyright © by JavaBeat · All rights reserved