Missing something with custom tags.

2011-02-02 Thread Bill Davidson
version 1.6.0_20, Java(TM) SE Runtime Environment (build 
1.6.0_20-b02), Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed 
mode)

Tomcat: 6.0.26

I'm having trouble with a custom tag and I've tried to reduce the 
problem to its most basic form:


/WEB-INF/tags/example.tag:

%@tag %
%@attribute name=xName required=true rtexprvalue=true %
h1xName=${xName}/h1

/jsp/Example.jsp:

!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN 
http://www.w3.org/TR/html4/strict.dtd;
%@page language=java contentType=text/html; charset=UTF-8 
pageEncoding=UTF-8 %

%@taglib prefix=ex tagdir=/WEB-INF/tags %
html
body
ex:example xName=Testing Example /
/body
/html

I usually get:

You have run into a org.apache.jasper.JasperException: 
/jsp/Example.jsp(6,4) Unable to find setter method for attribute: xName 
error.


But sometimes I get this:

You have run into a java.lang.ClassNotFoundException: 
org.apache.jsp.jsp.Example_jsp error.


Any idea what I'm doing wrong?  From what I can see, my code seems to mirror
examples I've found in books and on the web.  Intermittent results 
suggest a race
condition to me though that seems odd here.  I've not had good luck with 
google on

this error.

Full stack traces for the exceptions here:

Feb 2, 2011 1:55:02 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /jsp/Example.jsp(6,4) Unable to find 
setter method for attribute: xName
at 
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at 
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at 
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
at 
org.apache.jasper.compiler.Generator$GenerateVisitor.evaluateAttribute(Generator.java:2809)
at 
org.apache.jasper.compiler.Generator$GenerateVisitor.generateSetters(Generator.java:3032)
at 
org.apache.jasper.compiler.Generator$GenerateVisitor.generateCustomDoTag(Generator.java:2452)
at 
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1736)

at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at 
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)

at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
at 
org.apache.jasper.compiler.Generator.generate(Generator.java:3440)
at 
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
at 
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
at 
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at 
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at 
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
at 
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
at 
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)

at java.lang.Thread.run(Thread.java:619)

Feb 2, 2011 1:55:29 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: 

Re: Missing something with custom tags.

2011-02-02 Thread Konstantin Kolinko
2011/2/3 Bill Davidson bill...@gmail.com:

 Unable to find setter method for attribute: xName error.

I think you are bumping into JavaBeans capitalization rules. Rename
your attribute to be xname or xxName.

IIRC, setXName( ) means that the property name is XName, not xName.

More details should be in the JavaBeans spec,
http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html


Best regards,
Konstantin Kolinko

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Missing something with custom tags.

2011-02-02 Thread Bill Davidson

On 2/2/2011 2:17 PM, Konstantin Kolinko wrote:
I think you are bumping into JavaBeans capitalization rules. Rename
your attribute to be xname or xxName.

That worked.  Weird.


-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Missing something with custom tags.

2011-02-02 Thread Bill Davidson

On 2/2/2011 2:17 PM, Konstantin Kolinko wrote:
I think you are bumping into JavaBeans capitalization rules. Rename
your attribute to be xname or xxName.

That worked!  Thanks!

I think that's a pretty weird thing.

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



RE: Missing something with custom tags.

2011-02-02 Thread Martin Gainty

need to see the tld declaration for your tags
and the Java class declared for the tag

pls ping me offline

Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




 Date: Wed, 2 Feb 2011 14:03:54 -0800
 From: bill...@gmail.com
 To: users@tomcat.apache.org
 Subject: Missing something with custom tags.
 
 version 1.6.0_20, Java(TM) SE Runtime Environment (build 
 1.6.0_20-b02), Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed 
 mode)
 Tomcat: 6.0.26
 
 I'm having trouble with a custom tag and I've tried to reduce the 
 problem to its most basic form:
 
 /WEB-INF/tags/example.tag:
 
 %@tag %
 %@attribute name=xName required=true rtexprvalue=true %
 h1xName=${xName}/h1
 
 /jsp/Example.jsp:
 
 !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01//EN 
 http://www.w3.org/TR/html4/strict.dtd;
 %@page language=java contentType=text/html; charset=UTF-8 
 pageEncoding=UTF-8 %
 %@taglib prefix=ex tagdir=/WEB-INF/tags %
 html
 body
 ex:example xName=Testing Example /
 /body
 /html
 
 I usually get:
 
 You have run into a org.apache.jasper.JasperException: 
 /jsp/Example.jsp(6,4) Unable to find setter method for attribute: xName 
 error.
 
 But sometimes I get this:
 
 You have run into a java.lang.ClassNotFoundException: 
 org.apache.jsp.jsp.Example_jsp error.
 
 Any idea what I'm doing wrong?  From what I can see, my code seems to mirror
 examples I've found in books and on the web.  Intermittent results 
 suggest a race
 condition to me though that seems odd here.  I've not had good luck with 
 google on
 this error.
 
 Full stack traces for the exceptions here:
 
 Feb 2, 2011 1:55:02 PM org.apache.catalina.core.StandardWrapperValve invoke
 SEVERE: Servlet.service() for servlet jsp threw exception
 org.apache.jasper.JasperException: /jsp/Example.jsp(6,4) Unable to find 
 setter method for attribute: xName
  at 
 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
  at 
 org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
  at 
 org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
  at 
 org.apache.jasper.compiler.Generator$GenerateVisitor.evaluateAttribute(Generator.java:2809)
  at 
 org.apache.jasper.compiler.Generator$GenerateVisitor.generateSetters(Generator.java:3032)
  at 
 org.apache.jasper.compiler.Generator$GenerateVisitor.generateCustomDoTag(Generator.java:2452)
  at 
 org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1736)
  at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
  at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
  at 
 org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
  at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
  at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
  at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
  at 
 org.apache.jasper.compiler.Generator.generate(Generator.java:3440)
  at 
 org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)
  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
  at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
  at 
 org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
  at 
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
  at 
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
  at 
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
  at 
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
  at 
 org.apache.catalina.core.ApplicationFilterChain.doFilter

Re: Missing something with custom tags.

2011-02-02 Thread Mark Thomas
On 02/02/2011 22:25, Martin Gainty wrote:
 
 need to see the tld declaration for your tags

There is none. It is implicit. You need to read the JSP spec.

 and the Java class declared for the tag

It is a tag file - there is none. Again, you need to read the JSP spec.

 pls ping me offline

Please don't. This is a community that discusses issues *on the mailing
list* so everyone can benefit from reading the archives.

Mark

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org