Every example that I try from the Beginning JSP 2.0 book that uses JSTL blows up on me when I try to view the page. A good example is from page 133:
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt_rt" %>
<html>
<head>
<title>Using a JavaBean</title>
</head>
<body>
<h2>Using a JavaBean</h2>
<jsp:useBean id="myCar" class="com.wrox.cars.CarBean" />
I have a <jsp:getProperty name="myCar" property="make" /> <br/>
My car costs <fmt:formatNumber value="${myCar.price}" type="currency" />
</body>
</html>
I created the bean OK and it works fine. However, the bold line above causes the following error:
exception
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(
Js pCompilationContext.java:561)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:300)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:293)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:240)
javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
root cause
java.lang.IllegalArgumentException: -63
org.apache.jasper.compiler.SmapStratum$LineInfo.se tOutputLineIncrement(SmapStratum.java:124)
org.apache.jasper.compiler.SmapStratum.optimizeLin eSection(SmapStratum.java:221)
org.apache.jasper.compiler.SmapUtil.evaluateNodes( SmapUtil.java:490)
org.apache.jasper.compiler.SmapUtil.generateSmap(S mapUtil.java:123)
org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:301)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:453)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:439)
org.apache.jasper.JspCompilationContext.compile(
Js pCompilationContext.java:555)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:300)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:293)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:240)
javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
I am able to reference the attribute as ${myCar.price} and display it that way but using the formatNumber causes the problem. I get the same problem if I try to use any other taglib e.g. <c:choose>.
I believe that I have the jstl libraries in the correct place, here is my directory structure:
webapps/Reuse/carPage2.jsp
webapps/Reuse/WEB-INF/classes => contains a bunch of directories with the bean inside
webapps/Reuse/WEB-INF/lib => contains all jstl jar files
I am running Tomvat v5.0.7 (installed from .exe file) on Windows 2000. I have jstl standard version 1.0.3.
Any help would be much appreciated.
Alan