Skip to main content

Java Tag Library problem

No replies
wrast34
Offline
Joined: 2007-08-24

I have a problem with my application's java custom tag library. There is an error dealing with setter method naming which appears for two out of fifty or so tags. Here's the description:

org.apache.jasper.JasperException: /brands/previsor/customersettings/solutionlist.jsp(409,3) PWC6339: Cannot find a setter method for the attribute vals2 of the tag handler com.previsor.platform.tags.ui.CheckboxGroup

Here's the tag that I'm calling:

" vals2="<%=szValueString%>" labelTexts="<%=labelTexts%>" labels="<%=labels%>" rules="required,maxSelected" all="true" none="true" maxSelected="5" />

The value of "szValueString" is, as you might imagine, a simple String.

Here is the setter method in my tag, CheckBoxGroup.java:

public void setVals2( String vals3 )
{
this.vals2 = vals3;
String [] tempVals = this.vals2.split( "," );
this.alValues.clear();
for ( int a = 0; a < tempVals.length; a++ )
{
this.alValues.add( tempVals[a] );
}
}

I used to have it like this, but I thought passing an ArrayList might be causing problems:

public void setValues( ArrayList values )
{
this.values = values;
}

Here's the TLD entry:


vals2
false
true

In all cases, I get the same error. Here's what I've tried:

1. Changing the name of the attribute to something else to avoid some unknown collision (along with the member variable name and setter method to match).
2. Changing the data type of the attribute
3. Changing the order the attributes appear in the tag jsp code.
4. Changing the TLD to make the attribute not required.
5. Changing the name of the setter method to all lower case.
6. Passing a null value as the attribute value.
7. Passing an empty ArrayList as the attribute value.
8. Keeping the bad attribute and adding a completely new one to pass the data.
9. Removing the vals2 attribute entirely <-- This works, but the tag is useless without it.
10. Removing the vals2 attribute entirely and adding another attribute to pass the data. (failed)

I thought it must be the data I'm passing, but after trying an empty ArrayList, an array of Strings, and finally a simple String value, I no longer do. Does anyone have any idea what Glassfish is looking for in a tag's setter method? Keep in mind, 48 out of the 50 tags I've written continue to work flawlessly. The two which do not work have only one thing in common: at the start of my troubles, both the bad attributes were named "values". I've done everything I could think of to eliminate that name as a cause.