2014-02-25 54 views
1

我是新來的primefaces dynaform,我只是建立一個簡單的網頁,並得到非常混亂的錯誤。我有2個按鈕,這將生成不同的動態。它運行與第一按鈕井內,但是我無法點擊第二個,並得到了錯誤primefaces:使用dynaform創建奇怪的錯誤

java.lang.IllegalArgumentException: Either HTTP 500 or java.lang.Throwable error page is required in web.xml or web-fragment.xml. Neither was found. 
    at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handleAjaxException(FullAjaxExceptionHandler.java:204) 
    at org.omnifaces.exceptionhandler.FullAjaxExceptionHandler.handle(FullAjaxExceptionHandler.java:175) 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119) 
    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 org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1494) 
    at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:205) 
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1465) 
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:499) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137) 
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557) 
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231) 
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086) 
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428) 
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193) 
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020) 
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135) 
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255) 
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:154) 
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116) 
    at org.eclipse.jetty.server.Server.handle(Server.java:370) 
    at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489) 
    at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960) 
    at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021) 
    at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865) 
    at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240) 
    at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668) 
    at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608) 
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543) 
    at java.lang.Thread.run(Thread.java:744) 

這裏是我的網頁

<html xmlns="http://www.w3.org/1999/xhtml" 
    xmlns:ui="http://java.sun.com/jsf/facelets" 
    xmlns:h="http://java.sun.com/jsf/html" 
    xmlns:f="http://java.sun.com/jsf/core" 
    xmlns:p="http://primefaces.org/ui" 
    xmlns:c="http://java.sun.com/jsp/jstl/core" 
    xmlns:pe="http://primefaces.org/ui/extensions"> 
<ui:composition template="/templates/theme.xhtml"> 
    <ui:define name="contentPrimary"> 
     <h:form> 
      <p:layout id="layout" style="height:100%"> 
       <p:layoutUnit position="west" size="400" style="padding:5px"> 
        <p:growl id="growl" showDetail="true" /> 
        <p:fieldset legend="Instance details"> 
         <h:panelGrid columns="2"> 
          <p:commandButton immediate="true" value="In process" 
           actionListener="#{processInstanceBean.testDynaform1}" 
           update="dynaTaskForm"> 
          </p:commandButton> 
          <p:commandButton immediate="true" value="Complete" 
           actionListener="#{processInstanceBean.testDynaform2}" 
           update="dynaTaskForm"> 
          </p:commandButton> 
         </h:panelGrid> 
        </p:fieldset> 
       </p:layoutUnit> 
       <p:layoutUnit position="center" id="instanceDetailView" 
        style="padding:5px"> 
        <p:panel id="dynaTaskForm"> 
         <h:panelGroup id="dynaFormGroup"> 
          <pe:dynaForm id="dynaForm" value="#{processInstanceBean.model}" 
           var="data"> 
           <pe:dynaFormControl type="input" for="txt"> 
            <p:inputText id="txt" value="#{data.value}" 
             required="#{data.required}"> 
            </p:inputText> 
           </pe:dynaFormControl> 
          </pe:dynaForm> 
         </h:panelGroup> 
        </p:panel> 
       </p:layoutUnit> 
      </p:layout> 

     </h:form> 
    </ui:define> 
</ui:composition> 
</html> 

和我的豆

@ManagedBean(name = "processInstanceBean") 
@SessionScoped 
public class ProcessInstanceController implements Serializable { 

    private DynaFormModel model = new DynaFormModel(); 
    public void testDynaform2() { 
     model = new DynaFormModel(); 
     DynaFormRow row = model.createRegularRow(); 
     DynaFormLabel label11 = row.addLabel("LABEL2"); 
     DynaFormControl control12 = null; 
     control12 = row.addControl(new BookProperty("2", false), "input"); 

     label11.setForControl(control12); 
    } 

    public void testDynaform1() { 
     model = new DynaFormModel(); 

     DynaFormRow row = model.createRegularRow(); 
     DynaFormLabel label11 = row.addLabel("LABEL1"); 
     DynaFormControl control12 = null; 
     control12 = row.addControl(new BookProperty("1", false), "input"); 

     label11.setForControl(control12); 

    } 

回答

-1

刪除immediate="true"並使用process="@this"代替您的命令按鈕。