PrimeFaces自动完成3.3.1不适合我

时间:2012-07-03 14:10:08

标签: jsf-2 primefaces

我使用PrimeFaces展示实验室代码设置了一个测试页面来测试该组件。当我开始在自动填充框中输入时,我收到一个例外。请注意,根据我是否启用了客户端或服务器状态保存,例外情况会有所不同。我使用的是WebLogic 11g,PrimeFaces 3.3.1,Apache Tomahawk 1.1.13和Mojarra 2.1.8。有什么想法吗?

AutoCompleteBean.java

@ManagedBean
public class AutoCompleteBean {  

    private String txt1;        

    public List<String> complete(String query) {  
        List<String> results = new ArrayList<String>();  

        for (int i = 0; i < 10; i++) {  
            results.add(query + i);  
        }  

        return results;  
    }  

    public String getTxt1() {  
        return txt1;  
    }  

    public void setTxt1(String txt1) {  
        this.txt1 = txt1;  
    }  

}  

autocomplete.xhtml

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html 
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui">

<h:head></h:head>

<h:form id="form">  
    <p:panel header="AutoComplete" toggleable="true" id="panel">  
            <h:outputLabel value="Simple :" for="acSimple" />  
            <p:autoComplete id="acSimple" value="#{autoCompleteBean.txt1}"   
                    completeMethod="#{autoCompleteBean.complete}"/>                         
    </p:panel>  
</h:form>  

</html>

javax.faces.STATE_SAVING_METHOD = client

时出现异常
Jul 3, 2012 10:00:03 AM com.sun.faces.renderkit.ClientSideStateHelper doGetState
SEVERE: Not in GZIP format
java.io.IOException: Not in GZIP format
        at java.util.zip.GZIPInputStream.readHeader(GZIPInputStream.java:137)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:58)
        at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:68)
        at com.sun.faces.renderkit.ClientSideStateHelper.doGetState(ClientSideStateHelper.java:244)
        at com.sun.faces.renderkit.ClientSideStateHelper.getState(ClientSideStateHelper.java:211)
        at com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:100)
        at com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreView(FaceletPartialStateManagemen
tStrategy.java:331)
        at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:138)
        at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
        at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:513)
        at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142)
        at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:303)
        at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
        at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
        at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
        at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
        at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
        at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
        at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
        at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
        at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
        at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
        at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
        at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
        at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

javax.faces.STATE_SAVING_METHOD =服务器

时出现异常
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1937)
    at com.sun.faces.renderkit.ServerSideStateHelper.getState(ServerSideStateHelper.java:277)
    at com.sun.faces.renderkit.ResponseStateManagerImpl.getState(ResponseStateManagerImpl.java:100)
    at com.sun.faces.application.view.FaceletPartialStateManagementStrategy.restoreView(FaceletPartialStateManagementStrategy.java:331)
    at com.sun.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:138)
    at com.sun.faces.application.view.ViewHandlingStrategy.restoreView(ViewHandlingStrategy.java:123)
    at com.sun.faces.application.view.FaceletViewHandlingStrategy.restoreView(FaceletViewHandlingStrategy.java:513)
    at com.sun.faces.application.view.MultiViewHandler.restoreView(MultiViewHandler.java:142)
    at javax.faces.application.ViewHandlerWrapper.restoreView(ViewHandlerWrapper.java:303)
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:192)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:292)
    at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3592)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2202)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2108)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1432)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)

1 个答案:

答案 0 :(得分:1)

问题是由Apache Tomahawk库引起的。一旦我删除了战斧JAR(幸运的是我可以没有它),问题就消失了。看起来好像战斧和PrimeFaces并不能很好地融合在一起,这是一种耻辱。我今天使用最新的战斧JAR(1.1.13)。