struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Haroon Rafique <haroon.rafi...@utoronto.ca>
Subject RE: [Struts 2 + EJB 3] injection of EJBs into struts 2 actions
Date Fri, 04 Dec 2009 13:13:36 GMT
On Today at 11:58am, JC=>James Cook <James.Cook@wecomm.com> wrote:

JC> EJB's can only be injected into other EJB's or Servlets, a struts 2
JC> action is essentially a pojo not a servlet. So you would either have to
JC> do a lookup in the context, or if you are using Spring look at using a
JC> jndi lookup and inject that reference into your class.
JC> 
JC> Cookie

Celinio,

You can also use a Servlet simply for the purpose of invoking EJBs (let's 
call it EJBInvokerServlet) and then use the @Resource notation to bring 
any local EJB into your Action. See:
http://osdir.com/ml/user-struts.apache.org/2009-07/msg00842.html

Hope that helps.

JC> 
JC> -----Original Message-----
JC> From: Fernandes Celinio [mailto:cfernandes@sopragroup.com] 
JC> Sent: 04 December 2009 11:37
JC> To: user@struts.apache.org
JC> Subject: [Struts 2 + EJB 3] injection of EJBs into struts 2 actions
JC> 
JC> Hi,
JC> I know that it is not possible to inject EJB in Struts 2 actions.
JC> The following annotation would not work :
JC> @EJB
JC> MyBeanLocal mybean;
JC>  
JC> But how come ? Since a Struts action is a servlet and injection works in
JC> a servlet, injection should work.
JC>  
JC> Thanks for enlightening me.
JC>  
JC> 
JC> ---------------------------------------------------------------------
JC> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
JC> For additional commands, e-mail: user-help@struts.apache.org
JC> 
JC> 

--
Haroon Rafique
<haroon.rafique@utoronto.ca>


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


Mime
View raw message