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

Cookie

-----Original Message-----
From: Fernandes Celinio [mailto:cfernan...@sopragroup.com] 
Sent: 04 December 2009 11:37
To: user@struts.apache.org
Subject: [Struts 2 + EJB 3] injection of EJBs into struts 2 actions

Hi,
I know that it is not possible to inject EJB in Struts 2 actions.
The following annotation would not work :
@EJB
MyBeanLocal mybean;
 
But how come ? Since a Struts action is a servlet and injection works in
a servlet, injection should work.
 
Thanks for enlightening me.
 

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

Reply via email to