Quantcast
Channel: GlassFish Related Items on Java.net
Viewing all articles
Browse latest Browse all 1091

CDI only happening in struts actions

$
0
0

I have one Front-End project that uses Struts calling a Service layer which initially relied on hand made DAO's.
I swapped my DAO for Stateless EJB's
The "debug" pages where some struts actions were directly calling the EJB worked perfectly with @Inject tags.

public class ShowSPAction extends ActionSupport {

private static final long serialVersionUID = 3182718664721840375L;

private static final Logger LOG = Logger.getLogger(ShowSPAction.class);

private List<SP> sps;

@Inject
private ServiceProviderDao dao;

public ShowServiceProviderAction()
{
//dao = new ServiceProviderDaoBean();
}

public String execute() throws NamingException
{
sps = dao.getAll();
LOG.fatal("List contains : " + sps.size());

return ActionSupport.SUCCESS;
}
public List<SP> getSps() {
return sps;
}
public void setSps(List<SP> sps) {
this.sps = sps;
}
}

But similar code (@Inject) does NOT work in the Service Layer which is usually called by Struts.
I was wondering why ... ???
I tried @EJB annotation but NO CAN DO :(

Do I have to make a Separate project for my EJB's ... ?

Tx,

\T,


Viewing all articles
Browse latest Browse all 1091

Trending Articles