You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Richa Oberoi <ri...@newgen.co.in> on 2000/03/01 12:16:29 UTC

Unable to make my own tag with 3.1M1 !!!!!

hi!!!

i am trying to make my own tag quiet similar to the given taglib example 
so i started by making MyTag.java file very similar to FooTag.java extending same ExampletagBase and implementing BodyTag
now this tag has 4 attributes or scripting variables whose values i provide in my.jsp (similar to foo.jsp)
also made MyTagExtraInfo.java similar to FooTagExtraInfo.java
all these java files r in the same directory as for foo

now my.jsp looks something like this

<html>

<body>

<%@ taglib uri="http://java.apache.org/tomcat/examples-taglib" prefix="eg" %>

<ul>

<eg:My MyAttr="Richa" NameAttr="Name" IsAttr="Is" RichaAttr="Richa">

<li><%= AttributeName %></li>

</eg:My>

</ul>

</body>

</html>



i have also made an entry of this tag in the TLD like this (again quiet similar to foo)

<!-- A simple Tag -->

<!-- My tag -->

<tag>

<name>My</name>

<tagclass>examples.MyTag</tagclass>

<teiclass>examples.MyTagExtraInfo</teiclass>

<bodycontent>JSP</bodycontent>

<info>

Perform a server side action; uses 3 mandatory attributes

</info>

<attribute>

<name>MyAttr</name>

<required>true</required>

</attribute>

<attribute>

<name>NameAttr</name>

<required>true</required>

</attribute>

<attribute>

<name>IsAttr</name>

<required>true</required>

</attribute>

<attribute>

<name>RichaAttr</name>

<required>true</required>

</attribute>

</tag>



now the problem is     the java files MyTag.java and MyTagExtraInfo.java compile fine but when i compile the My.jsp in explorer it gives the following error

Error: 500
Internal Servlet Error:


org.apache.jasper.JasperException: Unable to find setter method for attribute: MyAttr
	at org.apache.jasper.compiler.TagBeginGenerator.generateSetters(Compiled Code)
	at org.apache.jasper.compiler.TagBeginGenerator.generateServiceMethodStatements(TagBeginGenerator.java:206)
	at org.apache.jasper.compiler.TagBeginGenerator.generate(TagBeginGenerator.java:275)
	at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(Compiled Code)
	at org.apache.jasper.compiler.JspParseEventListener.generateAll(Compiled Code)
	at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseEventListener.java:159)
	at org.apache.jasper.compiler.Compiler.compile(Compiled Code)
	at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:226)
	at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:137)
	at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:148)
	at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:255)
	at org.apache.jasper.runtime.JspServlet.service(Compiled Code)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
	at org.apache.tomcat.core.ServletWrapper.handleInvocation(Compiled Code)
	at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:224)
	at org.apache.tomcat.core.ContextManager.service(ContextManager.java:347)
	at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
	at org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:305)
	at java.lang.Thread.run(Thread.java:466)

another thing i would like to mention is i tried modifying FooTag.java first by removing 1 attribute and then by adding another(that is making them 4) 
and correspondingly making changes in the jsp and the TLD it works fine  !!!!!

i am working on Windows NT and using VCafe 3.0 JVM

so Please help !!!!!!




Re: Unable to make my own tag with 3.1M1 !!!!!

Posted by Richa Oberoi <ri...@newgen.co.in>.
thanx a lot it works now !!!!
----- Original Message -----
From: Danno Ferrin <sh...@earthlink.net>
To: <to...@jakarta.apache.org>
Sent: Wednesday, March 01, 2000 9:09 PM
Subject: Re: Unable to make my own tag with 3.1M1 !!!!!


> Read the java beans spec:
>
>  getMyAttr and setMyAttr when made to a property the first character is
> dropped in case (unless the second character is uppercase) so the attr
> is myAttr not MyAttr.
>
> Richa Oberoi wrote:
> >
> > hi!!!
> >
> > i am trying to make my own tag quiet similar to the given taglib example
> > so i started by making MyTag.java file very similar to FooTag.java
extending same ExampletagBase and implementing BodyTag
> > now this tag has 4 attributes or scripting variables whose values i
provide in my.jsp (similar to foo.jsp)
> > also made MyTagExtraInfo.java similar to FooTagExtraInfo.java
> > all these java files r in the same directory as for foo
> >
> > now my.jsp looks something like this
> >
> > <html>
> >
> > <body>
> >
> > <%@ taglib uri="http://java.apache.org/tomcat/examples-taglib"
prefix="eg" %>
> >
> > <ul>
> >
> > <eg:My MyAttr="Richa" NameAttr="Name" IsAttr="Is" RichaAttr="Richa">
> >
> > <li><%= AttributeName %></li>
> >
> > </eg:My>
> >
> > </ul>
> >
> > </body>
> >
> > </html>
> >
> > i have also made an entry of this tag in the TLD like this (again quiet
similar to foo)
> >
> > <!-- A simple Tag -->
> >
> > <!-- My tag -->
> >
> > <tag>
> >
> > <name>My</name>
> >
> > <tagclass>examples.MyTag</tagclass>
> >
> > <teiclass>examples.MyTagExtraInfo</teiclass>
> >
> > <bodycontent>JSP</bodycontent>
> >
> > <info>
> >
> > Perform a server side action; uses 3 mandatory attributes
> >
> > </info>
> >
> > <attribute>
> >
> > <name>MyAttr</name>
> >
> > <required>true</required>
> >
> > </attribute>
> >
> > <attribute>
> >
> > <name>NameAttr</name>
> >
> > <required>true</required>
> >
> > </attribute>
> >
> > <attribute>
> >
> > <name>IsAttr</name>
> >
> > <required>true</required>
> >
> > </attribute>
> >
> > <attribute>
> >
> > <name>RichaAttr</name>
> >
> > <required>true</required>
> >
> > </attribute>
> >
> > </tag>
> >
> > now the problem is     the java files MyTag.java and MyTagExtraInfo.java
compile fine but when i compile the My.jsp in explorer it gives the
following error
> >
> > Error: 500
> > Internal Servlet Error:
> >
> > org.apache.jasper.JasperException: Unable to find setter method for
attribute: MyAttr
> >         at
org.apache.jasper.compiler.TagBeginGenerator.generateSetters(Compiled Code)
> >         at
org.apache.jasper.compiler.TagBeginGenerator.generateServiceMethodStatements
(TagBeginGenerator.java:206)
> >         at
org.apache.jasper.compiler.TagBeginGenerator.generate(TagBeginGenerator.java
:275)
> >         at
org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(C
ompiled Code)
> >         at
org.apache.jasper.compiler.JspParseEventListener.generateAll(Compiled Code)
> >         at
org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseE
ventListener.java:159)
> >         at org.apache.jasper.compiler.Compiler.compile(Compiled Code)
> >         at
org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:226)
> >         at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java:137)
> >         at
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:148)
> >         at
org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:255)
> >         at org.apache.jasper.runtime.JspServlet.service(Compiled Code)
> >         at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
> >         at
org.apache.tomcat.core.ServletWrapper.handleInvocation(Compiled Code)
> >         at
org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:224)
> >         at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:347)
> >         at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpC
onnectionHandler.java:144)
> >         at
org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:305)
> >         at java.lang.Thread.run(Thread.java:466)
> >
> > another thing i would like to mention is i tried modifying FooTag.java
first by removing 1 attribute and then by adding another(that is making them
4)
> > and correspondingly making changes in the jsp and the TLD it works fine
!!!!!
> >
> > i am working on Windows NT and using VCafe 3.0 JVM
> >
> > so Please help !!!!!!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Re: Unable to make my own tag with 3.1M1 !!!!!

Posted by Danno Ferrin <sh...@earthlink.net>.
Read the java beans spec:

 getMyAttr and setMyAttr when made to a property the first character is
dropped in case (unless the second character is uppercase) so the attr
is myAttr not MyAttr.  

Richa Oberoi wrote:
> 
> hi!!!
> 
> i am trying to make my own tag quiet similar to the given taglib example
> so i started by making MyTag.java file very similar to FooTag.java extending same ExampletagBase and implementing BodyTag
> now this tag has 4 attributes or scripting variables whose values i provide in my.jsp (similar to foo.jsp)
> also made MyTagExtraInfo.java similar to FooTagExtraInfo.java
> all these java files r in the same directory as for foo
> 
> now my.jsp looks something like this
> 
> <html>
> 
> <body>
> 
> <%@ taglib uri="http://java.apache.org/tomcat/examples-taglib" prefix="eg" %>
> 
> <ul>
> 
> <eg:My MyAttr="Richa" NameAttr="Name" IsAttr="Is" RichaAttr="Richa">
> 
> <li><%= AttributeName %></li>
> 
> </eg:My>
> 
> </ul>
> 
> </body>
> 
> </html>
> 
> i have also made an entry of this tag in the TLD like this (again quiet similar to foo)
> 
> <!-- A simple Tag -->
> 
> <!-- My tag -->
> 
> <tag>
> 
> <name>My</name>
> 
> <tagclass>examples.MyTag</tagclass>
> 
> <teiclass>examples.MyTagExtraInfo</teiclass>
> 
> <bodycontent>JSP</bodycontent>
> 
> <info>
> 
> Perform a server side action; uses 3 mandatory attributes
> 
> </info>
> 
> <attribute>
> 
> <name>MyAttr</name>
> 
> <required>true</required>
> 
> </attribute>
> 
> <attribute>
> 
> <name>NameAttr</name>
> 
> <required>true</required>
> 
> </attribute>
> 
> <attribute>
> 
> <name>IsAttr</name>
> 
> <required>true</required>
> 
> </attribute>
> 
> <attribute>
> 
> <name>RichaAttr</name>
> 
> <required>true</required>
> 
> </attribute>
> 
> </tag>
> 
> now the problem is     the java files MyTag.java and MyTagExtraInfo.java compile fine but when i compile the My.jsp in explorer it gives the following error
> 
> Error: 500
> Internal Servlet Error:
> 
> org.apache.jasper.JasperException: Unable to find setter method for attribute: MyAttr
>         at org.apache.jasper.compiler.TagBeginGenerator.generateSetters(Compiled Code)
>         at org.apache.jasper.compiler.TagBeginGenerator.generateServiceMethodStatements(TagBeginGenerator.java:206)
>         at org.apache.jasper.compiler.TagBeginGenerator.generate(TagBeginGenerator.java:275)
>         at org.apache.jasper.compiler.JspParseEventListener$GeneratorWrapper.generate(Compiled Code)
>         at org.apache.jasper.compiler.JspParseEventListener.generateAll(Compiled Code)
>         at org.apache.jasper.compiler.JspParseEventListener.endPageProcessing(JspParseEventListener.java:159)
>         at org.apache.jasper.compiler.Compiler.compile(Compiled Code)
>         at org.apache.jasper.runtime.JspLoader.loadJSP(JspLoader.java:226)
>         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:137)
>         at org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.java:148)
>         at org.apache.jasper.runtime.JspServlet.serviceJspFile(JspServlet.java:255)
>         at org.apache.jasper.runtime.JspServlet.service(Compiled Code)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:865)
>         at org.apache.tomcat.core.ServletWrapper.handleInvocation(Compiled Code)
>         at org.apache.tomcat.core.ServletWrapper.handleRequest(ServletWrapper.java:224)
>         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:347)
>         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:144)
>         at org.apache.tomcat.service.TcpConnectionThread.run(TcpEndpoint.java:305)
>         at java.lang.Thread.run(Thread.java:466)
> 
> another thing i would like to mention is i tried modifying FooTag.java first by removing 1 attribute and then by adding another(that is making them 4)
> and correspondingly making changes in the jsp and the TLD it works fine  !!!!!
> 
> i am working on Windows NT and using VCafe 3.0 JVM
> 
> so Please help !!!!!!