struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Chelimsky" <>
Subject incorrect selection of overridden setter
Date Tue, 08 Jul 2003 12:05:14 GMT
In the publishing system I'm developing, there is a TextLink class that has
a LinkableType as a member. LinkableType tells me whether this TextLink
links to a Page or an Asset (e.g. a pdf or a video). The TextLink has the
following methods:

public LinkableType getLinkableType()
public void setLinkableType(LinkableType type) //used by DAO when textLink
is being loaded from database
public void setLinkableType(String typeName) //intended for use by Struts or
other client code

The latter method looks up the correct LinkableType by name.

In my jsp, I have the following:

<html:hidden property="textLink.linkableType">

When the page is rendered, the type appears correctly. I assume it calls
form.getTextLink().getLinkableType().toString(). When the page is submitted,
however, I get an IllegalArgumentError stating that setLinkableType(String)
can not be applied to setLinkableType(LinkableType).

I've worked around this by adding these methods:

public LinkableType getLinkableTypeName()
public void setLinkableTypeName(String typeName)

and changing the jsp to:

<html:hidden property="textLink.linkableTypeName">

While this does work, I find it a bit stickly and I'm surprised that Struts,
or BeanUtils, wouldn't be able to find the correct setter method. Anybody
else have this experience or advice on implementation?


ps - using Struts 1.1 rc2 / jboss 3.2.1

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message