JSTL xml taglib throwing errors

I have the following JSP pasted below. If I try to compile it is throwing the following exception.
javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/saxpath/SAXPathException
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:268)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)


root cause

java.lang.ClassNotFoundException: org.saxpath.SAXPathException
      java.net.URLClassLoader$1.run(Unknown Source)
      java.security.AccessController.doPrivileged(Native Method)
      java.net.URLClassLoader.findClass(Unknown Source)
      java.lang.ClassLoader.loadClass(Unknown Source)
      java.lang.ClassLoader.loadClass(Unknown Source)
      java.lang.Class.getDeclaredMethods0(Native Method)
      java.lang.Class.privateGetDeclaredMethods(Unknown Source)
      java.lang.Class.getDeclaredMethods(Unknown Source)
      java.beans.Introspector$1.run(Unknown Source)
      java.security.AccessController.doPrivileged(Native Method)
      java.beans.Introspector.getPublicDeclaredMethods(Unknown Source)
      java.beans.Introspector.getTargetMethodInfo(Unknown Source)
      java.beans.Introspector.getBeanInfo(Unknown Source)
      java.beans.Introspector.getBeanInfo(Unknown Source)
      org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3864)
      org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2131)
      org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1619)
      org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
      org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
      org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
      org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
      org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
      org.apache.jasper.compiler.Generator.generate(Generator.java:3416)
      org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
      org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:717)




<%@ page contentType="text/html" isELIgnored="true"%>   
<%@ taglib  prefix="c" uri="http://java.sun.com/jstl/core"%> 
<%@ taglib  prefix="x" uri="http://java.sun.com/jstl/xml"%>  

<html>  
<body>  
 <c:import   url="books.xml"    var="url" />  
 <x:parse       xml="${url}"     var="doc"   />

 -----------------------------------------------<br>

 <x:forEach     var="n"   
                     select="$doc/books/book">
 <x:out     select="$n/title"  />
  <br>  
 <x:out     select="$n/author"  />  
  <br>

 ========  
 <br>  
 </x:forEach>
</body>
</html>

Open in new window

prsubjectAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rrzCommented:
Please tell what version of Tomcat you are using. Also tellus what version of java you are using.
I think you need to download and install the Xalan jar.  
After you install it, please try the following code.
%@ page contentType="text/html" isELIgnored="true"%>   
<%@ taglib  prefix="c" uri="http://java.sun.com/jstl/core"%> 
<%@ taglib  prefix="x" uri="http://java.sun.com/jstl/xml"%>  

<html>  
<body>  
 <c:import   url="books.xml"    var="url" />  
 <x:parse       xml="${url}"     var="doc"   />

 -----------------------------------------------<br>

 <x:forEach select="$doc/books/book">
 <x:out     select="title"  />
  <br>  
 <x:out     select="author"  />  
  <br>

 ========  
 <br>  
 </x:forEach>
</body>
</html>

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rrzCommented:
You can get the Xalan jar   at  
http://www.hightechimpact.com/Apache/xml/xalan-j/   
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.