jQuery in Action, 2nd edition*
The moose likes Servlets and the fly likes Why i got error when i run the the code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic

Why i got error when i run the the code

Indravadan T Patel

Joined: Sep 09, 2007
Posts: 29
Hi All,

i here show you my JSP, TLD and Taghandler class.
<%@ taglib uri="/WEB-INF/tlds/SimpleTag.tld" prefix="csajsp" %>
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>

<csajsp:Multi length="20"/><br>
<csajsp:Multi length="40"/>

<?xml version="1.0" encoding="UTF-8"?>
<taglib version="2.0" 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-jsptaglibrary_2_0.xsd">
package indra;

import java.math.BigInteger;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.JspException;
import java.io.*;
import java.math.*;
public class SimplePrimeTag extends TagSupport {
private String length="60";
// private boolean length;

public int doStartTag() {
try {
JspWriter out = pageContext.getOut();
int len = Integer.parseInt(getLength());
out.println("Multiplication :" +len*len);
} catch (Exception ex) {


return (SKIP_BODY);

public boolean isLength(){
return true;

public void setLength(String length) {
this.length = length;

public String getLength() {
return length;

and i got error like that :

org.apache.jasper.JasperException: /index.jsp(11,12) Unable to find setter method for attribute: length


Indravadan Patel
Christophe Verré

Joined: Nov 24, 2005
Posts: 14688

Please do not duplicate posts. Continue the discussion in the original thread.

[My Blog]
All roads lead to JavaRanch
subject: Why i got error when i run the the code