Posts

Showing posts from August, 2011

Narrow down the problem

I guess narrow down the problem is the most important process when solving a problem.

Two ways to retrieve the named object

The first way more general:
private ContractSchedulezFacade lookupFacade() {
try {
Context c = new InitialContext();
return (ContractSchedulezFacade) c.lookup("java:app/itmems4-ejb/ContractSchedulezFacade!info.goyun.facade.ContractSchedulezFacade");
} catch (NamingException ne) {
Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
throw new RuntimeException(ne);
}
}

The second way from FacesContext if using JSF:
ScheduleZCategoryController controller = (ScheduleZCategoryController) facesContext.getApplication().getELResolver().
getValue(facesContext.getELContext(), null, "scheduleZCategoryController");