我有一个带有命令链接的数据表,我想将一个对象传递给bean。命令链接上的action属性直接指向同一页面,即没有导航。因此(我认为/怀疑),或者由于其他原因,bean中的setter方法没有被实现,因此我在bean中的对象为null。我该如何处理plz。下面是数据表、setter和我的方法的摘录。Thnx
<h:commandLink value="Delete"actionListener="#bOQMasterManager.removeBOQ}" action="boqmaster">
<f:setPropertyActionListener target="#{bOQMasterManager.boqmasterPK}"
value="#{boqs.boqmasterPK}" />
</h:commandLink>
public void setBoqmasterPK(BoqmasterPK boqmasterPK) {
System.out.println("In the setter!!!");
this.boqmasterPK = boqmasterPK;
}
public void removeBOQ(ActionEvent event) {
try {
System.out.println("In removeBOQ!!!");
request.removeBoq(boqmasterPK);
logger.info("Removed BOQ .");
} catch (IllegalArgumentException e) {
System.out.println("In the exception!!!"+e.getMessage());
}
}
首先我希望
actionListener="#bOQMasterManager.removeBOQ}"
是
actionListener="#{bOQMasterManager.removeBOQ}"
并且setBoqmasterPK
是在bOQMasterManager
Bean中定义的,getBoqmasterPK
必须在boqs
中定义
public void setBoqmasterPK(BoqmasterPK boqmasterPK) {
System.out.println("In the setter!!!");
this.boqmasterPK = boqmasterPK;
}