Mega Code Archive

 
Categories / Java / JSP
 

JSP Displaying a Subset in XML

/* <people>   <person>     <name>Peter</name>     <age>54</age>   </person>   <person>     <name>Patricia</name>     <age>50</age>   </person> </people> */ <%@ taglib uri="http://java.sun.com/jstl/xml"  prefix="x" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> <html >   <head>     <title>Displaying a Subset</title>   </head>   <body>     <c:import url="http://localhost:8080/chapter02/people.xml"               var="inputDoc" />     <x:parse  xml = "${inputDoc}"               var = "parsedDoc" />     Here is a list of people over the age of 45:     <ul>       <x:forEach select="$parsedDoc/people/person/name[../age > 45]"                  var="currentName" >         <li><x:out select="." />       </x:forEach>     </ul>   </body> </html>