Hi, can anyone help me w/ this:
1. Created the following custom 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>
2. Created the following 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>
<h2>$$ Weekend Prices...Hurry$$</h2>
<tags:catalog>
<jsp:attribute name="normalPrice">
${name}<br>
${price}
</jsp:attribute>
<jsp:attribute name="onSale">
Item: ${name}<br>
<strike>Was: ${origPrice}</strike><br>
<b>Now: ${salePrice}</b>
</jsp:attribute>
</tags:catalog>
</body>
</html>
3. Got the following error when trying to view the page:
org.apache.jasper.JasperException: Unable to compile class for JSP
org.apache.jasper.JspCompilationContext.compile(
Js pCompilationContext.java:609)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:300)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:294)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
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(P arser.java:1340)
org.apache.jasper.compiler.Parser.parseElements(Pa rser.java:1590)
org.apache.jasper.compiler.Parser.parse(Parser.jav a:172)
org.apache.jasper.compiler.ParserController.parse( ParserController.java:254)
org.apache.jasper.compiler.ParserController.parse( ParserController.java:154)
org.apache.jasper.compiler.ParserController.parse( ParserController.java:140)
org.apache.jasper.compiler.Compiler.generateJava(C ompiler.java:250)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:458)
org.apache.jasper.compiler.Compiler.compile(Compil er.java:444)
org.apache.jasper.JspCompilationContext.compile(
Js pCompilationContext.java:603)
org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:300)
org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:294)
org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:241)
javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
Any suggestions?