All I meant was that the value="[0]" evaluates to a Door object, which 
implements an IDoor, which I want to use for the setter method.

The documentation for type conversions says:

"The framework cannot instantiate an object if it can't determine an 
appropriate implementation. It recognizes well-known collection interfaces 
(List, Set, Map, etc) but cannot instantiate MyCustomInterface when all it sees 
is the interface. In this case, instantiate the target implementation first 
(eg. in a prepare method) or substitute in an implementation."

I'm not smart enough to understand what that means...


-----Original Message-----
From: Adam Hardy [mailto:ahardy.str...@cyberspaceroad.com] 
Sent: Wednesday, February 04, 2009 11:41 AM
To: Struts Users Mailing List
Subject: Re: Problem passing interface implementing object to an action from a 
jsp

Hi Mike,

I can't quite figure out what you're doing wrong. Don't know what you mean 
exactly about the "iterator value" - but I guess the problem lies with the 
config for your type conversions.

Do you have an xwork-conversions or an action-conversion.properties? That's 
where you tell the xwork engine which converter to use for that class and 
setter.

Mike Baranski on 04/02/09 16:28, wrote:
> Here's my delima:
> 
> I have an interface to represent a Door, called IDoor
> I have an interface to represent a DoorProvider, called IDoorProvider.
> 
> I use Spring to inject the DoorProvider implementation for the particular
> application to get lists of doors.
> 
> I have an UnlockDoorAction that will unlock an IDoor implementing Door (that
> comes from a provider)
> 
> Here is my UnlockDoorAction code that is relevant:
> 
>       public String execute() throws Exception
>         {
>             this.getDoor().unlockDoor(-1);
>             return SUCCESS;
>         }
> 
>      public IDoor getDoor()
>         {
>             return this.door;
>         }
> 
>      public void setDoor(IDoor cd)
>         {
>             this.door = cd;
>         }
> 
> Here is the JSP code that causes this action to be executed:
> 
> <s:url var="unlock_url" action="unlock" namespace="/door_control"><s:param
> name="door" value="[0]"/></s:url>
> <s:a href="%{unlock_url}"><center><img alt="Locked" src="<s:url
> value="/images/locked.png"/>" border="none"/></center></s:a>
> 
> Now, the value="[0]" is an iterator value of an object that implements the
> IDoor interface.
> 
> The Action returns "input", which (I think) is because it can't figure out
> how to set the parameter on the UnlockDoorAction.  How do I make the thing
> recognize that setDoor(IDoor cd) will take that parameter?


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to