• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

custom tag doubt

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does your web.xml say?
[ January 21, 2005: Message edited by: Nitish Bahadur ]
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
When evil is afoot and you don't have any arms you gotta be hip and do the legwork, but always kick some ... tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic