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

<html>
<head>
<title>Using XML</title>
</head>
<body>
<h1><center>   Using XML With JavaBean</center></h1>
<font size="+1"><b>
<c:import var="theclass" url="http://www.umsl.edu/~siegelj/CS4010/JSP/students.xml"/>
<x:parse xml="${theclass}" var="output"/>
<c:set var="justademo">Just a Demo</c:set>
<h2>${justademo}</h2><br />
<c:set var="thename">
    <x:out select="$output/students/student[2]/name"/>
</c:set>
<c:set var="theyear">
    <x:out select="$output/students/student[2]/year"/>
</c:set> 
<c:set var="thetestgrade">
    <x:out select="$output/students/student[2]/testgrade"/>
</c:set> 
<jsp:useBean id="a_student"   class="mybeans.studentBean" scope="page"> </jsp:useBean>
<jsp:setProperty name="a_student" property="name"   value='${thename}'/>
<jsp:setProperty name="a_student" property="year"  value='${theyear}'/>
<jsp:setProperty name="a_student" property="testgrade"  value='${thetestgrade}'/>
  
<p>The a_student Name is: 
   <jsp:getProperty name="a_student" property="name"/>
</p>
<p>The Year is: 
   <jsp:getProperty name="a_student" property="year"/>
</p>
<p>The Entrance Examination Score: 
   <jsp:getProperty name="a_student" property="testgrade"/>
</p>
<p>The Whole Story: 
   <jsp:getProperty name="a_student" property="all"/>
</p>
</b></font>
</body>
</html>

use_XMLBean.jsp