Unable to find setter method for attribute: xCoord [message #188759] |
Wed, 28 February 2007 10:23  |
Eclipse User |
|
|
|
Originally posted by: michael.halford.sheenmicro.com
Ok, I'm having trouble with a custom tag:-
The TLD (the relevant bits):-
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library
1.2//EN" "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
<taglib>
<tlib-version>1.2</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name>sf</short-name>
<uri>http://stuff.com/tag</uri>
<name>myTag</name>
<tag-class>com.stuff.MyTag</tag-class>
<body-content>empty</body-content>
<attribute>
<name>yCoord</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>double</type>
</attribute>
<attribute>
<name>xCoord</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
<type>double</type>
</attribute>
</taglib>
The Tag class...
public class MyTag extends TagSupport
{
private double xCoord;
private double yCoord;
... other stuff in here including doStartTag() ....
public double getXCoord()
{
return xCoord;
}
/**
* @param coord the xCoord to set
*/
public void setXCoord(double val)
{
this.xCoord = val;
}
/**
* @return the yCoord
*/
public double getYCoord()
{
return yCoord;
}
/**
* @param coord the yCoord to set
*/
public void setYCoord(double val)
{
this.yCoord = val;
}
}
The jsp...
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://stuff.com/tag" prefix="atag" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<atag:myTag
xCoord="1.0"
yCoord="0.0"
/>
</body>
</html>
The problem is that I'm continually getting a runtime
exception--org.apache.jasper.JasperException: "Unable to find setter
method for attribute: xCoord"
Things I have tried already:-
setting the attrbute type to String, eg omitting the <type> in the tld
and having the setter method take a String.
I have checked that the code is recompiled and deployed correctly etc
etc....
I'm using Tomcat 5.5, Java1.5.0_11 and Eclipse Version: 3.2.2
Build id: M20070212-1330
So, the question is , why can't it find the setter method???
|
|
|
|
Powered by
FUDForum. Page generated in 0.03926 seconds