Need Help to improve preformance when displaying a Large List
trind Feb 4, 2010 1:41 PMAtm when i display list with many items around 1500 or so it takes 10-15 sec until the page is rendered on the Webbrowser.
I user Seam 2.2 and Jboss Server 5.1, any tips what i should do diffrent?
import lu.ldc.lea.entity.DomainName;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.List;
import java.util.Arrays;
@Name("domainNameList")
public class DomainNameList extends EntityQuery<DomainName> {
private static final String EJBQL = "select domainName from DomainName domainName";
private static final String[] RESTRICTIONS = {
"lower(domainName.domainName) like concat(lower(#{domainNameList.domainName.domainName}),'%')",
"lower(domainName.dnsMx) like concat(lower(#{domainNameList.domainName.dnsMx}),'%')",
"lower(domainName.dnsZoneFileUpdate) like concat(lower(#{domainNameList.domainName.dnsZoneFileUpdate}),'%')",
"lower(domainName.dnsA) like concat(lower(#{domainNameList.domainName.dnsA}),'%')",
"lower(domainName.dnsAaaa) like concat(lower(#{domainNameList.domainName.dnsAaaa}),'%')",
"lower(domainName.dnsSoaRname) like concat(lower(#{domainNameList.domainName.dnsSoaRname}),'%')",
"lower(domainName.comment) like concat(lower(#{domainNameList.domainName.comment}),'%')", };
private DomainName domainName = new DomainName();
public DomainNameList() {
setEjbql(EJBQL);
setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
setMaxResults(2500);
}
public DomainName getDomainName() {
return domainName;
}
}
And my xhtml page is like this.
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:s="http://jboss.com/products/seam/taglib"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:rich="http://richfaces.org/rich"
template="../../layout/template.xhtml">
<ui:define name="body">
<h:form id="domainNameSearch" styleClass="edit">
<rich:simpleTogglePanel label="DomainName search parameters" switchType="ajax">
<s:decorate template="../../layout/display.xhtml">
<ui:define name="label">#{localization.getTranslation('lea.domainname')}</ui:define>
<h:inputText id="domainName" value="#{domainNameList.domainName.domainName}"/>
</s:decorate>
<s:decorate template="../../layout/display.xhtml">
<ui:define name="label">#{localization.getTranslation('lea.comment')}</ui:define>
<h:inputText id="comment" value="#{domainNameList.domainName.comment}"/>
</s:decorate>
</rich:simpleTogglePanel>
<div class="actionButtons">
<h:commandButton id="search" value="#{localization.getTranslation('lea.search')}" action="/Lea/admin/DomainNameList.xhtml"/>
<s:button
rendered="#{empty from}"
view="/Lea/admin/DomainNameEdit.xhtml"
id="create"
value="#{localization.getTranslation('lea.createdomainname')}">
<f:param name="domainNameId"/>
</s:button>
</div>
</h:form>
<rich:panel>
<f:facet name="header">#{localization.getTranslation('lea.domainsearchresult')}</f:facet>
<div class="results" id="domainNameList">
<h:outputText value="#{localization.getTranslation('lea.nosearchresultfordomainname')}"
rendered="#{empty domainNameList.resultList}"/>
<rich:dataTable id="domainNameList"
var="_domainName"
value="#{domainNameList.resultList}"
rendered="#{not empty domainNameList.resultList}">
<h:column>
<f:facet name="header">
<s:link styleClass="columnHeader"
value="#{localization.getTranslation('lea.customer')} #{domainNameList.order=='customer.customer asc' ? messages.down : ( domainNameList.order=='customer.customer desc' ? messages.up : '' )}">
<f:param name="order" value="#{domainNameList.order=='customer.customer asc' ? 'customer.customer desc' : 'customer.customer asc'}"/>
</s:link>
</f:facet>
<h:outputText value="#{_domainName.customer.customer}"/>
</h:column>
<h:column>
<f:facet name="header">
<s:link styleClass="columnHeader"
value="#{localization.getTranslation('lea.domainname')} #{domainNameList.order=='domainName.domainName asc' ? messages.down : ( domainNameList.order=='domainName.domainName desc' ? messages.up : '' )}">
<f:param name="order" value="#{domainNameList.order=='domainName.domainName asc' ? 'domainName.domainName desc' : 'domainName.domainName asc'}"/>
</s:link>
</f:facet>
<h:outputText value="#{_domainName.domainName}"/>
</h:column>
<h:column>
<f:facet name="header">
<s:link styleClass="columnHeader"
value="#{localization.getTranslation('lea.comment')} #{domainNameList.order=='comment asc' ? messages.down : ( domainNameList.order=='comment desc' ? messages.up : '' )}">
<f:param name="order" value="#{domainNameList.order=='comment asc' ? 'comment desc' : 'comment asc'}"/>
</s:link>
</f:facet>
<h:outputText value="#{_domainName.comment}"/>
</h:column>
<h:column>
<f:facet name="header">#{localization.getTranslation('lea.action')}</f:facet>
<s:link view="/Lea/admin/#{empty from ? 'DomainNameEdit' : from}.xhtml"
value="#{empty from ? localization.getTranslation('lea.edit') : localization.getTranslation('lea.select')}"
id="domainName">
<f:param name="domainNameId"
value="#{_domainName.id}"/>
</s:link>
</h:column>
</rich:dataTable>
</div>
</rich:panel>
<div class="tableControl">
<s:link view="/Lea/admin/DomainNameList.xhtml"
rendered="#{domainNameList.previousExists}"
value="#{messages.left}#{messages.left} First Page"
id="firstPage">
<f:param name="firstResult" value="0"/>
</s:link>
<s:link view="/Lea/admin/DomainNameList.xhtml"
rendered="#{domainNameList.previousExists}"
value="#{messages.left} Previous Page"
id="previousPage">
<f:param name="firstResult"
value="#{domainNameList.previousFirstResult}"/>
</s:link>
<s:link view="/Lea/admin/DomainNameList.xhtml"
rendered="#{domainNameList.nextExists}"
value="Next Page #{messages.right}"
id="nextPage">
<f:param name="firstResult"
value="#{domainNameList.nextFirstResult}"/>
</s:link>
<s:link view="/Lea/admin/DomainNameList.xhtml"
rendered="#{domainNameList.nextExists}"
value="Last Page #{messages.right}#{messages.right}"
id="lastPage">
<f:param name="firstResult"
value="#{domainNameList.lastFirstResult}"/>
</s:link>
</div>
</ui:define>
</ui:composition>