Why is the DataTable component built-in functionality for paging and sorting behavior differ from PrimeFaces 1.1 and 2.2.1?
Signature contains jar and server info and the below applies to both examples:
Managed Bean Scope: Request
primefaces 1.1 example:
1. load page: (got expected behavior)
2. execute call to load table: (got expected behavior)
3. clicked on paginator page link: (got expected behavior)
4. clicked on last name column to execute sort: (got expected behavior)
primefaces 2.2.1 example:
1. load page: (got expected behavior)
2. execute call to load table: (got expected behavior)
3. clicked on paginator page link: (did NOT get expected behavior)
- Note: The data was lost.
4. executed to load data table and clicked on last name column to execute sort: (did NOT get expected behavior)
- Note: The data was lost.
I noticed during the evaluation of the DataTable component, in 1.1 a call to the server is never initiated to get the list when using the paging and sorting features. When using the same component in 2.2.1 a call to the server is initiated to retrieve the managed bean list, but at this point it is a new request and i don't expect the list to have any data because the beans scope. i could be wrong, so a clarification would be appreciated.
DataTable component
Brendan, the logs are clean and I don't see an ArithmeticException logged on the server side. Also, the same exact faces config and bean code is used in both implementions of primefaces versions indicated in my posting signature.
facesConfig excerpt:
quoteBean:
Here is the bean that actually initializes the quoteList when the searchButton is clicked. The search method is executed when the button is clicked:
facesConfig excerpt:
searchControllerBean:
the symptom of the data being lost doesn't look to be isolated to just the paging and sorting features.
facesConfig excerpt:
Code: Select all
<managed-bean>
<managed-bean-name>quoteBean</managed-bean-name>
<managed-bean-class>com.test.poc.model.QuoteBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
Code: Select all
package com.test.poc.model;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import com.test.poc.dto.Quote;
import com.test.poc.dto.QuoteSearchCriteria;
public class QuoteBean implements Serializable {
private static final long serialVersionUID = 1L;
private QuoteSearchCriteria searchCriteria;
private List<Quote> quoteList;
public List<Quote> getQuoteList() {
if(quoteList == null)
{
quoteList = new ArrayList<Quote>();
}
return quoteList;
}
public void setQuoteList(List<Quote> quoteList) {
this.quoteList = quoteList;
}
public QuoteSearchCriteria getSearchCriteria() {
if(searchCriteria == null)
{
searchCriteria = new QuoteSearchCriteria();
}
return searchCriteria;
}
public void setSearchCriteria(QuoteSearchCriteria searchCriteria) {
this.searchCriteria = searchCriteria;
}
}
facesConfig excerpt:
Code: Select all
<managed-bean>
<managed-bean-name>searchController</managed-bean-name>
<managed-bean-class>com.test.poc.controller.SearchController</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>quoteDataList</property-name>
<list-entries>
<value-class>com.test.poc.dto.Quote</value-class>
<value>#{Quote1}</value>
<value>#{Quote2}</value>
<value>#{Quote3}</value>
<value>#{Quote4}</value>
<value>#{Quote5}</value>
<value>#{Quote6}</value>
</list-entries>
</managed-property>
</managed-bean>
Code: Select all
package com.test.poc.controller;
import java.io.Serializable;
import java.util.List;
import javax.faces.context.FacesContext;
import com.test.poc.dto.Quote;
import com.test.poc.model.QuoteBean;
public class SearchController implements Serializable {
private static final long serialVersionUID = 1L;
private List<Quote> quoteDataList;
public void setQuoteDataList(List<Quote> quoteDataList) {
this.quoteDataList = quoteDataList;
}
public String search()
{
String outcome = null;
FacesContext cxt = FacesContext.getCurrentInstance();
QuoteBean quoteBean = (QuoteBean) cxt.getApplication().evaluateExpressionGet(cxt, "#{quoteBean}", QuoteBean.class);
if(quoteBean != null)
{
if(quoteBean.getSearchCriteria().isSearchCriteriaSet())
{
quoteBean.setQuoteList(quoteDataList);
}
}
return outcome;
}
}
Primefaces-1.1
JSF 1.2 - Mojarra 1.2_14-b01-FCS
- jsf-api.jar
- jsf-impl.jar
Primefaces-2.2.1
JSF 2.0 - Mojarra 2.0.3-FCS
- jsf-api.jar
- jsf-impl.jar
Tomcat 6.0.29
JSF 1.2 - Mojarra 1.2_14-b01-FCS
- jsf-api.jar
- jsf-impl.jar
Primefaces-2.2.1
JSF 2.0 - Mojarra 2.0.3-FCS
- jsf-api.jar
- jsf-impl.jar
Tomcat 6.0.29
-
- Information
-
Who is online
Users browsing this forum: No registered users and 28 guests