• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

custom tag doubt

 
Sree Nivas
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm just trying to execute example cutom tag program given in HF Servlet & JSP file page no: 494 to 498.

Header.tag
<%@ attribute name="fontColor" required="true" %>
<%@ tag body-content="tagdependent" %>
<img src="images/gopika-dec28.jpg"><br>
<em><strong><font color="${fontColor}"><jsp oBody/></font></strong></em><br>

TestBean.jsp
<%@ taglib prefix="myTags" tagdir="/WEB-INF/tags" %>
<html><body>
<myTags:Header fontColor="#660099">
We take the string out of SOAP. OK, so it's not Jini,<br>
but we'll help you get through it with the least<br>
frustration and hair loss.
</myTags:Header>
</body></html>

But I'm getting the following error:
org.apache.jasper.JasperException: /TestBean.jsp(3,1) Unable to find setter method for attribute: fontColor
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:83)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:402)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:186)
org.apache.jasper.compiler.Generator$GenerateVisitor.evaluateAttribute(Generator.java:2643)
org.apache.jasper.compiler.Generator$GenerateVisitor.generateSetters(Generator.java:2791)
org.apache.jasper.compiler.Generator$GenerateVisitor.generateCustomDoTag(Generator.java:2335)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1670)
org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1457)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2156)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2206)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2212)
org.apache.jasper.compiler.Node$Root.accept(Node.java:484)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2156)
org.apache.jasper.compiler.Generator.generate(Generator.java:3228)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:284)
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:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

what's wrong here. Even I tried Page 494 example with <%@ attribute name="subTitle" required="true" rtexprvalue="true"%> and got the same error. This was working without attributes. I doubt, do we need any tld file for this? This is not mentioned in the book.

regads
Sreenivas
 
Nitish Bahadur
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your web.xml say?
[ January 21, 2005: Message edited by: Nitish Bahadur ]
 
Naresh Arige
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried your code on Tomcat 5.5 and its working well. Make sure to point the web-app_2_4 to schema path in the web.xml
[ January 21, 2005: Message edited by: Naresh Arige ]
 
Sree Nivas
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. My web.xml is pointing correct version.
<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">

Do we need any other entries in web.xml?

regards
Sreenivas
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic