JasperException - Variable directive has invalid attribute: fragment

kmthien

Senior member
Oct 8, 2002
363
0
0
Hi Guys,

I got a big trouble here !


/usr/local/tomcat5/webapps/wrox/WEB-INF/tags/catalog.tag
========================================================
<%@ attribute name="normalPrice" fragment="true" %>

<%@ variable fragment="normalPrice" name-given="name" %>

<%@ variable fragment="normalPrice" name-given="price" %>

<%@ attribute name="onSale" fragment="true" %>

<%@ variable fragment="onSale" name-given="name" %>

<%@ variable fragment="onSale" name-given="origPrice" %>

<%@ variable fragment="onSale" name-given="salePrice" %>

<table border="1">
<tr>
<td>
<jsp:invoke fragment="normalPrice">
<jsp: Param name="name" value="Hand-held Color PDA"/>
<jsp: Param name="price" value="$298.86"/>
</jsp:invoke>
</td>
<td>
<jsp:invoke fragment="onSale">
<jsp: Param name="name" value="4-Pack 150 Watt Light Bulbs"/>
<jsp: Param name="origPrice" value="$2.98"/>
<jsp: Param name="salePrice" value="$2.32"/>
</jsp:invoke>
</td>
<td>
<jsp:invoke fragment="normalPrice">
<jsp: Param name="name" value="Digital Cellular Phone"/>
<jsp: Param name="price" value="$68.74"/>
</jsp:invoke>
</td>
<td>
<jsp:invoke fragment="normalPrice">
<jsp: Param name="name" value="Baby Grand Piano"/>
<jsp: Param name="price" value="$10,800.00"/>
</jsp:invoke>
</td>
<td>
<jsp:invoke fragment="onSale">
<jsp: Param name="name" value="Luxury Car w/ Leather Seats"/>
<jsp: Param name="origPrice" value="$23,980.00"/>
<jsp: Param name="salePrice" value="$21,070.00"/>
</jsp:invoke>
</td>
</tr>
</table>
=========================================================

/usr/local/tomcat5/webapps/wrox/shopping.jsp
=========================================================
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags" %>
<html>
<head>
<title>Shopping: A Simple Tag Example</title>
</head>
<body>
<h1>ABC Store: New Year Sale</h1>
<hr>
<h2>$$ Weekend Prices...Hurry$$</h2>
<tags:catalog>
<jsp:attribute name="normalPrice">
${name}<br/>
${price}
</jsp:attribute>
<jsp:attribute name="onSale">
Item: ${name}<br/>
<font color="red"><strike>Was: ${origPrice}</strike></font><br/>
<b>Now: ${salePrice}</b>
</jsp:attribute>
</tags:catalog>
</body>
</html>
=========================================================

When I tried to display shopping.jsp from IE6, I got the following error:
=========================================================
exception

org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:561)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:285)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:232)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


root cause

java.lang.RuntimeException: org.apache.jasper.JasperException: /WEB-INF/tags/catalog.tag(1,1) Variable directive has invalid attribute: fragment
org.apache.jasper.compiler.ImplicitTagLibraryInfo.getTagFile(ImplicitTagLibraryInfo.java:173)
org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1346)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1646)
org.apache.jasper.compiler.Parser.parse(Parser.java:173)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:247)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:149)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:135)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:243)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:437)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:285)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:232)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)


note The full stack trace of the root cause is available in the Tomcat logs.
=========================================================

I installed tomcat 5.0.11 in RedHat 7.3 !
Thanks !!

rgrds,
Wire
 

Argo

Lifer
Apr 8, 2000
10,045
0
0
Look at:

Luxury Car w/ Leather Seats

I believe the backslash is causing problem here.
 

kmthien

Senior member
Oct 8, 2002
363
0
0
Hi,

I have tried to remove the slash but stilll the same problem !! It's look like

java.lang.RuntimeException: org.apache.jasper.JasperException
Variable directive has invalid attribute: fragment