primefaces:使用dynaform创建奇怪的错误

时间:2014-02-25 10:21:41

标签: jsf jsf-2 primefaces

我是primefaces dynaform的新手,我只是构建了一个简单的网页并且弄错了。我有2个按钮,它们将生成不同的动态变形。它用第一个按钮运行井,但是我无法点击第二个按钮,并且出现了错误

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 个答案:

答案 0 :(得分:-1)

删除immediate="true"并在命令按钮中使用process="@this"