File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
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="" xmlns:xsi="" xsi:schemaLocation=" 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.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
I agree. Here's the link:
subject: Why i got error when i run the the code
It's not a secret anymore!