JSTL XML Tag Library

JSTL XML Tag Library


Posted in : Java Posted on : April 26, 2012 at 7:38 PM Comments : [ 0 ]

This section contains the complete tutorial of JSTL XML tag library.

JSTL XML Tag Library

This section contains the complete tutorial of JSTL XML tag library.

To create and manipulate with the XML document XML tags are provided to the JSTL. These tags allowed to with XML documents in a JSP-centric way. XML tags in this library are well combination of JSP custom tags which allows for manipulating XML in pliable way. JSTL xml tags are generally used when you have to work mostly with xml documents instead of html documents. This tag facilitate the for exchanging data between loosely coupled system.

Moreover the standard XPath(XML Path Language) syntax following scopes, the way of access, web application data within XPath expression are held by the JSTL XPath engine :

  • $param
  • $header
  • $cookie
  • $initParam
  • $pageScope
  • $requestScope
  • $sessionScope
  • $applicationScope

The table given below is explaining the JSTL XML tag set.

Function Tags
 Core  out, parse, set
Flow Control  choose, when, otherwise,
forEach, if
Transformation transform, param

To use the tags of JSTL XML library following taglib would be required to add on your JSP page :

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

NOTE : To use the JSTL xml tag you will have to include the xalan-x.x.x.jar and xercesImpl-x.x.x.jar files I have downloaded the xalan-2.3.1.jar and xercesImpl-2.7.1.jar file. You can also download the xalan-2.3.1.jar file from here and to download the xercesImpl-2.7.1.jar file click here. And you can also download the above version of jar files from here. To download the other version of xalan-jar file you can click here and for xercesImpl.jar click here.

The above table describes that each tag has its own work purpose i.e they are defined as according to their functions such as :

  • out : This tag is just like the expressions in JSP that are used to insert values directly into the output for XPath epressions  Like <%= .... %>
  • parse : This tag is used to parse the xml content.
  • set : This tag is used to set the value in a scope resulted after evaluation of the XPath expression.
  • choose : This is a simple conditional tag that is used for setting up a circumstances for manually exclusive conditional operations using <when> and <otherwise>
  • when : This tag is a subtag of choose which includes its body when its conditional value is evaluated as 'true'.
  • otherwise : This tag is a subtag of choose which follows the when tag and is executed only if the body of when conditional value is evaluated as 'false'.
  • forEach : This tag is a XML iteration tag.
  • if : This tag is a xml conditional tag, its body is evaluated when the specified XPath expression is evaluated and returns a boolean value 'true'.
  • transform : Applies a transformation on an XML document.
  • param : This tag can be used as a subtag of transform to set parameter in the XSLT stylesheet.
Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics