Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials:
 

Software Solutions and Services
 

 
  JDO Tutorials
  EAI Articles
  Struts Tutorials
  Java Tutorials
  Java Certification
  Java Applet
Questions
Comments
 
Example of Variable Support Tags of JSTL Core Tag Library 
 

JSTL( Java Sever pages Standard Tag Library) provide simple tags of core functionality that are used in many web applications.

 

Example of Variable Support Tags of JSTL Core Tag Library

                         

JSTL( Java Sever pages Standard Tag Library) provide simple tags of core functionality that are used in many web applications. JSTL provides four tag libraries, here in this example we will see how to use core tag library of JSTL. uri for JSTL Core library is......

   http://java.sun.com/jsp/jstl/core

So before use Core JSTL tags we must include following line of code :-

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

JSTL core library provides following two tags for variable support....

1 :-   set :  Tag <c:set > is used to initialize a variable with some given value.
        For Example : <c:set var="name" value="Mahendra" scope="request" />
        Here we are initialize variable 'name' with value 'Mahendra'. We can also define scope of this variable by using attribute scope.

2:-  remove :  Tag <c:remove> is used to remove a scoped variable from a particular scope.
       For Example : <c:remove var="name" scope="request" />

In the example given below defines the use of variable support tags of JSTL Core tag library. We have also used tag <c:out> to show the variable in standard output device.
jstlExample.jsp

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"  %>
<html>
  <head>
    <title>Using Choose,Otherwise and When</title>
  </head>
  <body>
  <h2>This is Variable Support tags example of JSTL.</h2>
  <c:set var="fName" value="Mahendra" />
        <c:set var="lName" value="Singh" />
		<h3>Welcome.......
            <c:out value="${fName}" />
            <c:out value="${lName}" />
        </h3>
        <c:remove var="fName" />
     <!--variable fName will not show any 
         value because it has removed. -->
        <c:out value="${fName}" />
		<c:out value="${lName}" />
  </body>
</html>

Steps to run this example : 

1:  Download the zip file of code and unzip this file, you will get a folder named  'var_support_jstlCore'.
2:  Paste this folder in 'Apache Tomcat 6.0.16-->webapps' or generally in directory 'C:\apache-tomcat-6.0.16\webapps'.
3:  Start tomcat server by click on startup.bat file in 'C:\apache-tomcat-6.0.16\bin'.
4: Open browser and type url 'http://localhost:8080/var_support_jstlCore/jstlExample.jsp' or click on this link.

When program will run in browser this will show the following output.....

Download Source Code

                         

» View all related tutorials
Related Tags: c xml library file files stl orm ant form io user sed jstl tag parameter transform this js for add

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Website Designing Services
 
Web Designing Packages From $150!
 
Website Designing Company Web Hosting
 
Website Designing Quotation
 
Search Tutorials:

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.