對不起,我的英語不好。我遇到了JSF2 Primefaces的問題。我有一個包含panigation的數據表,它顯示每行末尾的客戶和按鈕列表。當用戶點擊按鈕網站時,會將用戶重定向到顯示客戶信息的新頁面。但它只適用於第一頁,當我旁邊的其他頁面按鈕不工作。 IDE不顯示任何錯誤。我究竟做錯了什麼?爲什麼不在任何可數據頁面上調用操作方法?謝謝。datatable按鈕與黃金面壟斷只適用於第一頁
觀
<h:form>
<p:fieldset legend="Danh sách khách hàng">
<p:dataTable var="customer" value="#{listCustomerBean.customers}"
paginator="true" rows="10" paginatorPosition="bottom"
paginatorTemplate="{FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}"
id="dskh" first="">
<p:column headerText="Mã khách hàng">
<h:outputText value="#{customer.customerId}"></h:outputText>
</p:column>
<p:column headerText="CMND">
<h:outputText value="#{customer.idNo}"></h:outputText>
</p:column>
<p:column headerText="Ngày cấp">
<h:outputText value="#{customer.idIssueDate}"></h:outputText>
</p:column>
<p:column headerText="Nơi cấp">
<h:outputText value="#{customer.idIssuePlace}"></h:outputText>
</p:column>
<p:column headerText="Tên khách hàng">
<h:outputText value="#{customer.name}"></h:outputText>
</p:column>
<p:column headerText="Ngày sinh">
<h:outputText value="#{customer.dob}"></h:outputText>
</p:column>
<p:column headerText="Giới tính">
<h:outputText value="#{customer.gender}"></h:outputText>
</p:column>
<p:column headerText="Quốc tịch">
<h:outputText value="#{customer.nationality}"></h:outputText>
</p:column>
<p:column headerText="Tỉnh">
<h:outputText value="#{customer.province}"></h:outputText>
</p:column>
<p:column headerText="Quận">
<h:outputText value="#{customer.district}"></h:outputText>
</p:column>
<p:column headerText="Xã">
<h:outputText value="#{customer.precinct}"></h:outputText>
</p:column>
<p:column headerText="Địa chỉ">
<h:outputText value="#{customer.address}"></h:outputText>
</p:column>
<p:column headerText="Tài khoản">
<h:outputText value="#{customer.accountId}"></h:outputText>
</p:column>
<p:column headerText="Email">
<h:outputText value="#{customer.email}"></h:outputText>
</p:column>
<p:column headerText="Di động">
<h:outputText value="#{customer.mobiNumber}"></h:outputText>
</p:column>
<p:column headerText="Thông báo Email">
<h:outputText value="#{customer.emailNotification}"></h:outputText>
</p:column>
<p:column headerText="Thông báo SMS">
<h:outputText value="#{customer.smsNotification}"></h:outputText>
</p:column>
<p:column headerText="Chọn">
<h:commandButton value="Xem"
action="#{listSubscriberBean.view(customer.accountId)}"></h:commandButton>
</p:column>
</p:dataTable>
<br></br>
</p:fieldset>
</h:form>
豆
@ManagedBean
@SessionScoped
public class ListCustomerBean implements Serializable {
private List<Customer> customers;
private CustomerDAO customerDAO = new CustomerDAO();
public List<Customer> getCustomers() {
return customers;
}
public ListCustomerBean() {
customers = customerDAO.findAll();
}
}
豆
@ManagedBean
@SessionScoped
public class ListSubscriberBean implements Serializable {
private List<Subscriber> subscribers;
private Customer customer;
private SubscriberDAO subscriberDAO = new SubscriberDAO();
private CustomerDAO customerDAO = new CustomerDAO();
private Long accId;
private String text;
public Customer getCustomer() {
return customer;
}
public void setCustomer(Customer customer) {
this.customer = customer;
}
public Long getAccId() {
return accId;
}
public void setAccId(Long accId) {
this.accId = accId;
}
public List<Subscriber> getSubscribers() {
return subscribers;
}
public String view(Long id) {
this.setAccId(id);
customer = customerDAO.findByAccountId(accId);
subscribers = subscriberDAO.findByAccountId(accId);
return "listSubscriber";
}
public String update() {
if (customerDAO.addCustomer(this.getCustomer()) == true) {
return "listSubscriber";
} else {
return "error";
}
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public ListSubscriberBean() {
}
}
什麼不起作用,除第一頁外的所有內容都有'?此外,這些詳細的會話範圍bean對於執行這類任務完全沒有必要。 –
Tiny
當我點擊下一頁的其他第一頁,然後不起作用,它只能在第一頁工作。 –
只能在黑暗中拍攝:如果它改變了行爲,可以使用''或使用'
'來查看''Ajaxical。 –
Tiny