This converter
is called from my JSF. I already register it inside faces-config.xml
public class ProjectConverter implements Converter{
@EJB
DocumentSBean sBean;
@ManagedProperty(value="#{logging}")
private Logging log;
public ProjectConverter(){
}
public Object getAsObject(FacesContext context, UIComponent component, String value)
{
if(value.trim().equals("")){
return null;
}
return sBean.getProjectById(value);
}
public String getAsString(FacesContext context, UIComponent component, Object value)
{
if(value == null){
return null;
}
return String.valueOf(((Project) value).getId());
}
}
I ran into java.lang.NullPointerException
, when I am in getAsObject()
, the primary reason is because my Session Bean sBean
is null. I dont know how to fix this, I need to access to my Session bean so that I can query from my database