Using the Core XML tags : XML « JSP « Java






Using the Core XML tags

<%@ taglib uri="http://java.sun.com/jstl/xml" prefix="x" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<html>
<head><title>Using the Core XML tags</title></head>
<body>
<h2>Here are the context-params and servlets from the XML file</h2>

<c:import url="http://localhost:8080/home/web.xml" var="webXml" />

<x:parse xml="${webXml}" var="doc" />

<h3>First the context params...</h3>

<x:forEach select="$doc//context-param">

    <x:out select="param-name"/>: <x:out select="param-value"/>

</x:forEach>

<h3>Now the servlet info...</h3>

<x:forEach select="$doc//servlet>

    <x:out select="servlet-name"/><br />
  <x:out select="servlet-class"/><br /><br />

</x:forEach>


</body>
</html>


           
       








Related examples in the same category

1.XML transformation
2.Performing XSL Transformations
3.JSP in pure XML generating conforming XHTML
4.XSLT In JSP
5.XSLT in JSP 2
6.JSP Parsing using the DOM
7.JSP Parsing using JDOM
8.JSP Parsing using the DOM and JSTL
9.JSP and SAX
10.JSP Displaying a Subset in XML
11.JSP XML and XSLT transform
12.JSP List of data in the XML document
13.Deal With XML In JSP