我的项目中有一个 selectCheckBoxMenu 的实现。我的 xhtml 文件中的部分代码是:-
<p:row >
<p:column style=" width: 497px; text-align: right;">
<h:outputText for="toMails" value="To : " />
</p:column>
<p:column style=" width: 497px; text-align: left;">
<p:selectCheckboxMenu id="toMails" value="#{schedule.selectedEmailIds}" label="Mail Recipients" filter="true"
filterText="Filter" filterMatchMode="startsWith" panelStyle="width:220px">
<f:selectItems value="#{schedule.users}" />
</p:selectCheckboxMenu>
</p:column>
</p:row>
我的 Bean 类有代码:-
private String[] selectedEmailIds;
private Map<String,String> users;
//Getters and Setters
//Value Loader Method
public void loadWorkFlowServices()
{
try
{
Map<String, String> tmpUsers = new HashMap<String, String>();
tmpUsers.put("Scarface", "Scarface");
tmpUsers.put("Goodfellas", "Goodfellas");
tmpUsers.put("Godfather", "Godfather");
tmpUsers.put("Carlito's Way", "Carlito's Way");
tmpUsers.put("Rang De Basanti", "Rang De Basanti");
tmpUsers.put("Despicable Me", "Despicable Me");
tmpUsers.put("The Dark Knight", "The Dark Knight");
setUsers(tmpUsers);
}
catch (Exception e)
{
LOGGER.error("Error while loading the workflow services.", e);
}
}
当我从下拉列表中选择任何值并提交时。我得到了例外 -
Error occurred while doing security check on URL hit
java.lang.NullPointerException
at org.primefaces.component.selectcheckboxmenu.SelectCheckboxMenu.queueEvent(SelectCheckboxMenu.java:199)
at javax.faces.component.UIInput.validate(UIInput.java:976)
at javax.faces.component.UIInput.executeValidate(UIInput.java:1233)
at javax.faces.component.UIInput.processValidators(UIInput.java:698)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
at javax.faces.component.UIComponentBase.processValidators(UIComponentBase.java:1214)
at javax.faces.component.UIForm.processValidators(UIForm.java:253)
我在网上找不到太多帮助。请提出我所缺少的。