struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Välimaa" <>
Subject Invoking action methods from jsp: parameter types
Date Fri, 06 Jun 2008 11:47:22 GMT
Hi all,

I'm trying to format a certain string property of an object differently
depending on the object state. For this, I'm trying to call an action method
from the jsp, like this:
<s:property value="%{ getFormattedIfDeleted( [0], [0].name ) }" />

My problem is the following: if I use my class type as the parameter type of
the first argument of the method, the jsp code never calls the action

This version of method is called:
    public String getFormattedIfDeleted( Object modelObject, String
objectText ) {...}

This is not called:
    public String getFormattedIfDeleted( AbstractBaseObject modelObject,
String objectText ) {...}

The actual object I use as the parameter extends AbstractBaseObject. So it
should qualify just as well for both. I've confirmed that the object type is
the right one by printing it out in jsp.

What's more, if I use the first method, the object is no longer recognized
as its own type by instanceof,  modelObject instanceof AbstractBaseObject
evaluates as false.

I' quessing there is something esoteric in OGNL playing havoc here, but
that's about it. Any idea what's wrong? Thanks in advance.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message