struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jukka Välimaa" <valimaa.ju...@gmail.com>
Subject Re: Invoking action methods from jsp: parameter types
Date Fri, 06 Jun 2008 13:57:05 GMT
Well, I managed to solve this one. Ognl didn't actually pass the object
itself to the method, but rather an instance of
com.opensymphony.xwork2.util.CompoundRoot. I managed to get the object I
needed by using its peek() method.

On Fri, Jun 6, 2008 at 2:47 PM, Jukka Välimaa <valimaa.jukka@gmail.com>
wrote:

> 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
> method.
>
> 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.
>
>

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