tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Travis McCauley <tw...@virginia.edu>
Subject JSTL confused by overloading accessor methods
Date Thu, 09 Jan 2003 18:45:39 GMT
Hello,

I've just spent about eight hours trying to figure out a bug in my 
web-app and it seems to have been caused by overloading a set method. 
This occurred after I all at once added a new attribute and three 
accessor methods to one of my java classes. When I referred to the 
attributes in <c:xxx> tags I got errors that the value 
'attributeName' was not found in an object of class.... It's the same 
error you get from referring to an attribute that actually doesn't 
exist.

The class I added these new attributes to is an abstract superclass 
for all the java beans in my app. Here's what I added:

private Vector analyticalNotes = null;

public void setAnalyticalNotes(Vector analyticalNotes)
{ this.analyticalNotes = analyticalNotes; }

public Vector getAnalyticalNotes()
{ return analyticalNotes; }

public void setAnalyticalNotes( String sql  )
{ do some jdbc stuff then setAnalyticalNotes with a new Vector }


Here is the JSTL code that was causing the error. The object was in 
the request and I was able to access the analyticalNotes attribute 
through jsp scripting.

<c:out value="${ requestScope.termTestBean.analyticalNotes }" /> <br />


I had to change the number of parameters in the signature of the 
overloading method to stop the error. So here's what I now have and 
everything is working now:

public void setAnalyticalNotes( String sql, Object 
nullObjectNeverUsedInMethod )


I tried actually changing String to many other things but in the end 
I had to add a new parameter. I can get by without a solution for 
this but it seems a little weird.

I'm running Tomcat 4.1.12 on Java 1.3 on Mac OS X. I get the same 
error with the JSTL 1.0.2 release AND with the nightly build. Any 
ideas what's up with this?

Sincerely,

Travis McCauley
Tibetan and Himalayan Digital Library
University of Virginia


--
To unsubscribe, e-mail:   <mailto:taglibs-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:taglibs-user-help@jakarta.apache.org>


Mime
View raw message