JSTL XML Tags

In JSTL, XML tags are used for creating and manipulating xml documents. The following syntax represent the URL of XML tag: –

To utilize the functionality of XML tags, it is required to download and add two jar files within the lib directory of your project. Following are the required jar files: –

  • XercesImpl.jar
  • xalan.jar

XML Tags

  • <x:out>: – This role of this tag is similar to <%=expression%> tag but for XPath expression.
  • <x:set>: – This tag associate the value with variable for XPath expression.
  • <x:if>: – This tag treats as a conditional statement for XPath expression.
  • <x:choose>: – This tag function as a switch statement for XPath expression.
  • <x:when>: – This tag is used to test the conditions just same as Case in switch statement.
  • <x:otherwise>: – This tag invokes if none of the <x:when> tag condition satisfies. Thus, it treats as default of switch statement.

Example of JSTL XML Tag

This example shows the functionality of various tags of JSTL XML.

index.jsp

Output:

Leave a Comment