• Post Reply Bookmark Topic Watch Topic
  • New Topic

Jstl Exception

 
prashanth Kotla
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • 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
 
Marimuthu Madasamy
Ranch Hand
Posts: 72
Java Monad Scala
  • Mark post as helpful
  • send pies
  • 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'
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!