• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in using JSTL 1.1 xml tags

 
lalit upadheyay
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am getting following exception whenever i try to invoke my example

javax.servlet.ServletException: com/sun/org/apache/xpath/internal/XPathException

I had jstl.jar(39 KB), standard.jar(878 kb), xalan.jar(3007 KB), xercesImpl.jar(1176 KB) in the \WEB_INF\lib. I also had all the 15 TLD's in the \WEB-INF\lib from the \jstl\tld directory in JSWDKK1.5 package in the \WEB-INF\tld in my web app.

I copied jstl.jar and standard.jar from \jstl\lib directory in JSWDKK1.5 package and copied xalan.jar, xercesImpl.jar from the xalan-j_2_7_0 package.

My web.xml contains
=======================================================
<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee web-app_2_4.xsd"
version="2.4" />


The JSP code i am trying to invoke (demo1.jsp) contains
=======================================================
<%@ page contentType="text/html" %>

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

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

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

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


The xml file i am trying to read(books.xml) contains
======================================================
<?xml version="1.0" ?>
<books>
<book>
<title>cobol</title>
<author>roy</author>
</book>
<book>
<title>java</title>
<author>herbert</author>
</book>
<book>
<title>c++</title>
<author>robert</author>
</book>
<book>
<title>coldfusion</title>
<author>allaire</author>
</book>
<book>
<title>xml unleashed</title>
<author>morrison</author>
</book>
<book>
<title>jrun</title>
<author>allaire</author>
</book>
</books>



Please do help me.

Regards,
Lalit
[ January 24, 2006: Message edited by: lalit upadheyay ]
 
lalit upadheyay
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Come on ranchers. Help me. I am sure that many people have overcome these difficulties and have used JSTL1.1 xml tags. For additional information, i am using tomcat 5.0.19 on windows XP professional edition (SP2).

Regards,
Lalit
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64716
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64716
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't have an answer to your specific question. But...

I also had all the 15 TLD's in the \WEB-INF\lib from the \jstl\tld directory in JSWDKK1.5 package in the \WEB-INF\tld in my web app.


The TLD s are already resident in the jar files. Why copy them? Tomcat will find the right TLDs by the URI that you specify in the taglib directives.

Simplifying your setup may not solve your problem, but it may help avoid future ones.
 
lalit upadheyay
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear Bibeault,

I have succesfully executed my examples. Yes you are absolutely right regrading tld's and i knew it as well. But its due to unsuccesfull attempts and searches that i followed the search results blindfoldedly.

At last i got the first right direction from url http://faq.javaranch.com/view?JstlTagLibDefinitions . So i removed the 2 xml specific jars, tld's and overwrite the JSWDP1.5 JSTL jars with the JSTL1.1 jars in jakarta-taglibs-standard-1.1.2 package.

Thanks for your feedback and sorry to invoke you for losing patience.

Regards,
Lalit
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic