我想將一個對象作爲參數發送到.xhtml頁面的Java類。從primefaces頁面向java bean類發送參數失敗
我有以下primefaces的數據網格:
<p:dataGrid value="#{userRequestBean.userActiveRequests}" var="userActiveRequest">
<h:panelGrid>
<h:commandButton value="Cancel" actionListener="#{userRequestBean.cancelRequest()}">
<f:setPropertyActionListener target="#{userRequestBean.request}"
value="${userActiveRequest}" />
</h:commandButton>
</h:panelGrid>
</p:dataGrid>
在我的豆,我有:
@ManagedBean(name = "userRequestBean")
@SessionScoped
public class UserRequestBean implements Serializable {
private TRequest request = new TRequest(); // plus get and set methods
public void cancelRequest(){
System.out.println("Author name: " + request.geId());
}
}
但是,當我按下按鈕,thows我NullPointerException異常。任何想法我怎麼能意識到這一點?提前致謝!
它的工作原理,非常感謝! – Tot