我制作了一个表格,将一些数据添加到我的数据库中。这是我的html编码。单击“提交”按钮时,go()
方法不会触发。这是为什么?
<form jsf:id="formAddDesignation">
<br/>
<div class="row">
<div class="col-xs-4">Designation Name</div>
<div class="col-xs-6">
<input type="text" required="true" jsf:value="#{designationBean.designationName}" placeholder="Designation name" jsf:id="designationName" class="form-control" />
</div>
</div>
<br/>
<div class="row">
<div class="col-xs-4">Designation Description</div>
<div class="col-xs-6">
<textarea class="form-control" jsf:value="#{designationBean.designationDescription}" placeholder="Designation description"></textarea>
</div>
</div>
<br/>
<div class="row" style="padding-right: 54px">
<button type="submit" jsf:id="btnAddDesignation" jsf:action="#{designationBean.go()}" class="btn btn-default col-xs-5 col-xs-offset-8 pull-right">Login
<f:ajax execute="formAddDesignation" render="logs" />
</button>
</div>
</form>
托管Bean(CDI)
@Named(value = "designationBean")
@RequestScoped
public class DesignationBean implements Serializable {
private String designationName;
private String designationDescription;
private Boolean status;
public DesignationBean() {
System.out.println("dddeeeee");
}
@PostConstruct
public void init() {
status = false;
System.out.println("ddddddddd");
designationName = "dddd";
}
public String getDesignationName() {
return designationName;
}
public void setDesignationName(String designationName) {
this.designationName = designationName;
}
public String getDesignationDescription() {
return designationDescription;
}
public void setDesignationDescription(String designationDescription) {
this.designationDescription = designationDescription;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
System.out.println("status");
}
public String go(){
System.out.println("Method is clicked");
return "clicked";
}
}
答案 0 :(得分:0)
只尝试&#34; designationBean.go&#34;没有括号。据我记忆,你不要括号!