我是新手在jsf網絡應用程序, 我創建一個jsf頁面與一個命令按鈕, 但它不會工作我不知道爲什麼? 我給actionlistener,行動後,但它不會工作, 所以請幫助我?p:commandbutton不工作或不叫
HTML代碼
<p:panelGrid columns="2" id="display" columnClasses="label,value">
<h:outputText value="Mobile Number" />
<p:inputMask id="phoneWithExt" value="#{GenerateOtp.EVD}" mask="(999) 999-9999" maxlength="10"/>
<h:outputText value="Mpin" />
<p:inputMask id="mpin" value="#{GenerateOtp.MPin}" mask="9-9-9-9" maxlength="4"/>
<h:outputText value="Imei Number" />
<p:inputText id="imei" alt="Imei Number" value="#{GenerateOtp.IMEI}"/>
<h:outputText value="User Agent" />
<p:inputText id="useragent" alt="User Agent" value="#{GenerateOtp.useragent}"/>
</p:panelGrid>
<p:commandButton id="call" type="button" value="Call"
actionListener="#{GenerateOtp.buttonAction(actionEvent)}"
process="@this"
icon="ui-icon-check" />
管理的bean:
@ManagedBean(name = "GenerateOtp")
@ViewScoped
public class GenerateOtp extends MasterRequest {
@SerializedName("EVD")
@Expose
private String eVD;
@SerializedName("mPin")
@Expose
private String mPin;
public String getEVD() {
return eVD;
}
public void setEVD(String eVD) {
this.eVD = eVD;
}
public String getMPin() {
return mPin;
}
public void setMPin(String mPin) {
this.mPin = mPin;
}
public void callOtp() {
System.out.println("evd" + getEVD());
}
public void buttonAction(ActionEvent actionEvent) {
addMessage("evd" + getEVD());
}
public void addMessage(String summary) {
FacesMessage message = new FacesMessage(FacesMessage.SEVERITY_INFO, summary, null);
FacesContext.getCurrentInstance().addMessage(null, message);
}
}
你的表格在哪裏? – BrunoDM
[commandButton/commandLink/ajax動作/偵聽器方法未被調用或輸入值未更新]的可能重複(https://stackoverflow.com/questions/2118656/commandbutton-commandlink-ajax-action-listener-method-not-invoked - 或 - 輸入值) – Kukeltje