Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » ServerTools (WTP) » Unable to find setter method for attribute: xCoord
Unable to find setter method for attribute: xCoord [message #188759] Wed, 28 February 2007 10:23 Go to next message
Eclipse UserFriend
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???
Re: Unable to find setter method for attribute: xCoord [message #188851 is a reply to message #188759] Thu, 01 March 2007 09:14 Go to previous message
Eclipse UserFriend
Originally posted by: michael.halford.xxxxxxxx.com

This problem appears to have been caused by naming the attributes xCoord
and yCoord. When I changed the names to xcoord and ycoord the code worked
OK
Previous Topic:Europa WST 1.6.0
Next Topic:Internal server error when starting WebService explorer.
Goto Forum:
  


Current Time: Tue Apr 23 07:28:30 GMT 2024

Powered by FUDForum. Page generated in 0.02783 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top