struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Cook" <James.C...@wecomm.com>
Subject RE: [Struts 2 + EJB 3] injection of EJBs into struts 2 actions
Date Fri, 04 Dec 2009 11:58:19 GMT
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:cfernandes@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-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message