0

我在项目中使用 JSF primefaces 和 Hibernate。我使用了 primefaces 布局单元。当我单击菜单项时,它会更新面板。但是当我尝试从托管 bean 执行方法时,它什么也不做。也没有错误信息。

托管 bean 的代码是:

@ManagedBean(name = "customerDetails")
@SessionScoped
@Entity
@Table(name = "CUSTOMER")
public class CustomerDetailsBean implements Serializable {   


    @Id
    @GeneratedValue
    @Column(name = "ID")
    private long customerId;

    @Column(name = "NAME")
    private String customerName;

    @Column(name = "DOB")
    private Date DOB;

    @Column(name = "ORG_NAME")
    private String organizationName;

    @Column(name = "MOBILE")
    private String mobile;

    @Column(name = "BEST_TIME_CALL")
    private String bestTimeToCall;

    @Column(name = "PROD_CAT")
    private String productCategory;

    @Column(name = "PROD")
    private String product;

    @Column(name = "REF_SRC")
    private String referralSource;

    @Column(name = "TELE_NAME")
    private String telesalesName;

    @Column(name = "TELE_CODE")
    private String telesalesCode;

    @Embedded
    @ManagedProperty(value = "#{customerAddressDetails}")
    private CustomerAddressDetailsBean addressDetailsBean;

    @Embedded
    @ManagedProperty(value = "#{customerLoanDetails}")
    private CustomerLoanDetailsBean loanDetailsBean;

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
        System.out.println(customerName);
    }

    public Date getDOB() {
        return DOB;
    }

    public void setDOB(Date dOB) {
        DOB = dOB;
    }

    public String getOrganizationName() {
        return organizationName;
    }

    public void setOrganizationName(String organizationName) {
        this.organizationName = organizationName;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public String getProductCategory() {
        return productCategory;
    }

    public void setProductCategory(String productCategory) {
        this.productCategory = productCategory;
    }

    public String getProduct() {
        return product;
    }

    public void setProduct(String product) {
        this.product = product;
    }

    public String getReferralSource() {
        return referralSource;
    }

    public void setReferralSource(String referralSource) {
        this.referralSource = referralSource;
    }

    public String getTelesalesName() {
        return telesalesName;
    }

    public void setTelesalesName(String telesalesName) {
        this.telesalesName = telesalesName;
    }

    public String getTelesalesCode() {
        return telesalesCode;
    }

    public void setTelesalesCode(String telesalesCode) {
        this.telesalesCode = telesalesCode;
    }

    public String getBestTimeToCall() {
        return bestTimeToCall;
    }

    public void setBestTimeToCall(String bestTimeToCall) {
        this.bestTimeToCall = bestTimeToCall;
    }

    public long getCustomerId() {
        return customerId;
    }

    public void setCustomerId(long customerId) {
        this.customerId = customerId;
    }

    public CustomerAddressDetailsBean getAddressDetailsBean() {
        return addressDetailsBean;
    }

    public void setAddressDetailsBean(CustomerAddressDetailsBean addressDetailsBean) {
        this.addressDetailsBean = addressDetailsBean;
    }

    public CustomerLoanDetailsBean getLoanDetailsBean() {
        return loanDetailsBean;
    }

    public void setLoanDetailsBean(CustomerLoanDetailsBean loanDetailsBean) {
        this.loanDetailsBean = loanDetailsBean;
    }

    public String insertCustomer() {
        System.out.println("inserting Customer");

        return "Login";

    }
}

xhtml 的代码是:

<p:commandButton id="btnSearch1" value="Search" type="Submit" action="#{customerDetails.insertCustomer}" update=":Centerform:Masters"/>
4

1 回答 1

0

我假设您的组件未放置在表单组件中。

执行以下操作:

<h:form>
   <!-- place the components and the button here -->
</h:form>
于 2013-10-08T09:27:12.337 回答