JSTL XML Tags Library

The XML tag library is used for creating and manipulating the xml data in jsp page and also transform the data used in jsp page. They are mostly used with xml documents rather then html documents.

The Syntax for the JSTL XML Tag

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

The JSTL XML Tags

  • <x: out>: It is used to display the result of xml path expression and writes result to the jsp writer.
  • <x: parse>: It is used to parse the xml content and the result is been stored in specified variable.
  • <x: set>: It is used to store the result of xml path expression in scoped variable.
  • <x: if>: The <x: if> tag evaluates an XPath expression and if the result is true then the body of the tag is evaluated.
  • <x: forEach>: This tag is used for looping over a list of elements in an xml document.
  • <x: choose>: The x:choose tag is XML tag used for checking conditional statements.
  • <x: when>: The <x:when> tag is to check to see whether the expression evaluates to be true. This is the subtag of <x:choose> tag.
  • <x: otherwise>: This is the subtag of <x:choose> which is used with <x:when> tag. This tag includes its body when all of the conditions specified using <x:when> tags evaluated to false.
  • <x: transform>: This tag is used to transform XML data based on XSLT script.
  • <x: param>: This tag is subtag of <x:transform> tag which is used with transform tag to set a parameter in the XSLT stylesheet.

Previous Tutorial : JSTL Format fmt:requestEncoding Tag :: Next Tutorial : JSTL XML x:out Tag

Comments

comments

About Krishna Srinivasan

He is Founder and Chief Editor of JavaBeat. He has more than 8+ years of experience on developing Web applications. He writes about Spring, DOJO, JSF, Hibernate and many other emerging technologies in this blog.

Speak Your Mind

*