i got this issue : i have a dataTable containing a list of object of Type Test class , and i have a column named "Assigned to" in which i wanna display the name of the user that the test shown in the row is assigned to so i wrote a method to do this :
<p:column headerText="Assigned to">
<h:outputText value="#{projectCampaignManagementMB.initAssignedToData(test)}" />
</p:column>
I'm getting this error:
nov. 04, 2012 4:42:06 PM com.sun.faces.context.PartialViewContextImpl$PhaseAwareVisitCallback visit
Grave: javax.el.ELException: /campaingManagement.xhtml @2388,132 value="#{projectCampaignManagementMB.initAssignedToData(test)}": java.lang.NullPointerException
Here's all the code :
<p:dataTable var="test" value="#{projectCampaignManagementMB.campaignTestList}" >
<p:column headerText="User">
</p:column>
<p:column headerText="Assigned to">
<h:outputText value="#{projectCampaignManagementMB.initAssignedToData(test)}" />
</p:column>
</dataTable>
the method :
public String initAssignedToData(Test pTest){
int assigendID = currentCampaign.getAssignedUserID(pTest);
User pUser = (User) userByID.get(new Integer(assigendID));
System.out.println("User assigned is = " + pUser + " , assigendID = " + assigendID);
return(((User) userByID.get(new Integer(assigendID))).getLoginFromModel()); // TO CHANGE
}
So is there another way to implement this. Many thanks