You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by wolverine my <wo...@gmail.com> on 2007/04/25 07:03:55 UTC

[S2] Access DAOs in Spring actions

Hi!

I have action classes configured in struts.xml and the DataSource,
SessionFactory, DAO objects configured in Spring's
applicationContext.xml.

How can I reference the DAO objects in my action class?

Please advise, thank you!

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


Re: [S2] Access DAOs in Spring actions

Posted by Adam Ruggles <a....@gmail.com>.
If you are using the spring plugin then all you should have to do is add 
a setter to your action class and spring will handle it.

ie

public void setUserDAO(IUserDAO userDAO) {
    this.userDAO = userDAO;
}

wolverine my wrote:
> Hi!
>
> I have action classes configured in struts.xml and the DataSource,
> SessionFactory, DAO objects configured in Spring's
> applicationContext.xml.
>
> How can I reference the DAO objects in my action class?
>
> Please advise, thank you!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>


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