我想直接从命令按钮调用 setter 并传递一个值。我的问题是,如果将 setter 作为字符串传回,则 setter 需要一个 Character 和 jsf。有没有一种好方法可以在前端“修复”这个问题,而不必在我的支持 bean 上超载设置器?
命令按钮:
<p:commandButton value="SignOff"
actionListener="#{manageItemHandler.dataEntryOp.setBomComplete('Y')}"
rendered="#{speed2Session.isRendered('editManageItemOp')}"/>
来自支持 bean 的 getter/setter:
protected Character bomComplete;
/**
* @return the bomComplete
*/
public Character getBomComplete() {
return bomComplete;
}
/**
* @param bomComplete the bomComplete to set
*/
public void setBomComplete(Character bomComplete) {
this.bomComplete = bomComplete;
}
当我单击命令按钮时,我得到
11:47:19,270 SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (http-steves-172.16.8.26-15081-1) JSF1073: javax.faces.event.AbortProcessingException caught during processing of INVOKE_APPLICATION 5 : UIComponent-ClientId=centerForm:j_idt271, Message=Method not found: data.operation.OperationData@595025a.setBomComplete(java.lang.String)
11:47:19,273 SEVERE [javax.enterprise.resource.webcontainer.jsf.context] (http-steves-172.16.8.26-15081-1) Method not found: data.operation.OperationData@595025a.setBomComplete(java.lang.String): javax.faces.event.AbortProcessingException: Method not found: data.operation.OperationData@595025a.setBomComplete(java.lang.String)