Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Jstl Exception

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Friends,
I am unable to execute simple jstl custom tag program.i am facing following program while running my jsp file.I am using jsp 2.0 version.

org.apache.jasper.JasperException: /com.cts.jsp/DemoTag.jsp(2,0) Unable to find setter method for attribute: optwo
Please see the code:
********** My Tag Handler class*************
package org.student;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;
public class SayBye extends TagSupport {
int sno=0,snum=0;

public SayBye(){
System.out.println("sayhello constructor");
}
public void setOpone(int sno){
this.sno=sno;
}
public void setOptw0(int snum){
this.snum=snum;
}

public int doEndTag()throws JspException{
System.out.println("doendtag method");
try{
int res=sno+snum;
JspWriter out=pageContext.getOut();
out.println(res);
}
catch(Exception e){
throw new JspException();

}

return SKIP_PAGE;
}
}
******My TLD file***********
<taglib>
<tlibversion>1.1</tlibversion>
<jspversion>2.0</jspversion>
<uri>http://www.students.org/ourtags</uri>;
<tag>
<name>SayHello</name>
<tag-class>org.student.SayHi</tag-class>
</tag>
<tag>
<name>add</name>
<tag-class>org.student.SayBye</tag-class>
<attribute>
<name>opone</name>
<required>true</required>
</attribute>
<attribute>
<name>optwo</name>
<required>true</required>
</attribute>
</tag>
</taglib>
****web.xml********
<?xml version="1.0" encoding="UTF-8"?>
<web-app>
<taglib>
<taglib-uri>http://www.students.org/ourtags</taglib-uri>;
<taglib-location>/WEB-INF/First.tld</taglib-location>
</taglib>
</web-app>
******my jsp file********
<%@taglib uri="http://www.students.org/ourtags" prefix="kotla"%>
<kotla:add opone="2" optwo="3"/>
*********
Please send me the solution if any body knows this problem,
I am eagerly waiting for your replies.
Bye
 
Ranch Hand
Posts: 72
Scala Monad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your setter method name should be


The last character in the method name should be alphabet 'o'. Earlier it was number '0'
 
reply
    Bookmark Topic Watch Topic
  • New Topic