1

IllegalStateException说组件 ID 表单已经在视图中找到,我不确定是什么导致了这个问题,我一开始不想要这个异常。

例外

Servlet.service() for servlet Faces Servlet threw exception: java.lang.IllegalStateException:
Component ID form:_captureFileOnsubmit has already been found in the view.
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:846) [:2.1.7-SNAPSHOT]
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:830) [:2.1.7-SNAPSHOT]
at com.sun.faces.util.Util.checkIdUniqueness(Util.java:830) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.view.StateManagementStrategyImpl.saveView(StateManagementStrategyImpl.java:135) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.StateManagerImpl.saveView(StateManagerImpl.java:133) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.view.WriteBehindStateWriter.flushToWriter(WriteBehindStateWriter.java:225) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.view.FaceletViewHandlingStrategy.renderView(FaceletViewHandlingStrategy.java:419) [:2.1.7-SNAPSHOT]
at com.sun.faces.application.view.MultiViewHandler.renderView(MultiViewHandler.java:125) [:2.1.7-SNAPSHOT]
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:121) [:2.1.7-SNAPSHOT]
at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) [:2.1.7-SNAPSHOT]
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139) [:2.1.7-SNAPSHOT]
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:594) [:2.1.7-SNAPSHOT]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.0.0.Final]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.0.0.Final]

我的xhtml页面看起来像:

<?xml version='1.0' encoding='UTF-8' ?>
<!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:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:icecore="http://www.icefaces.org/icefaces/core"   xmlns:ace="http://www.icefaces.org/icefaces/components"    xmlns:ice="http://www.icesoft.com/icefaces/component">
    <script type="text/javascript" src="/js/icefaces/ace-jquery.js" />
    <script type="text/javascript" src="/js/icefaces/ace-components.js" />
    <script type="text/javascript" src="/js/icefaces/icepush.js" />
    <script type="text/javascript" src="/js/icefaces/bridge.js" />
    <script type="text/javascript" src="/js/icefaces/compat.js" />
    <script type="text/javascript" src="/js/icefaces/fileEntry.js" />
    <script type="text/javascript" src="/js/icefaces/jsf.js" />
    <script type="text/javascript" src="/js/icefaces/icefaces-compat.js" />

    <h:head>
        <title>ICEfaces 3</title>
        <link rel="stylesheet" type="text/css" href="/xmlhttp/css/rime/rime.css"/>
    </h:head>
    <h:body>
             <h:form id="form">
                <h:outputText value="Welcome to ICEfaces 3, select current date: "/>
                <ace:dateTimeEntry renderAsPopup="true">
                    <f:convertDateTime pattern="MM/dd/yyyy" timeZone="Canada/Mountain"/>
                </ace:dateTimeEntry>
                <ace:fileEntry id = "fileUpload"
                               label="File Entry"
                               relativePath="uploaded"
                               fileEntryListener="#{fileUpload.uploadFile}"/>
             <h:commandButton value="Upload File" />
             </h:form>
    </h:body>
</html>

我所做的只是让fileUpload功能正常工作,奇怪的是文件夹中存在javascriptcss东西在javax.faces.resources应用程序中没有被引用,所以我得到了一些奇怪的错误。

另一件需要注意的事情是,如果我使用eclipse插件,icefaces那么fileUplaod功能可以正常工作,但如果我尝试在没有插件的情况下构建它们并且只使用标准的所需 jar 集,那么我会得到与组件 ID 相关的 IllegalStateException。

有什么想法,建议?

更新

<context-param>
    <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
    <param-value>true</param-value>
</context-param>

<context-param>
<param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.synchronousUpdate</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.blockingRequestHandler</param-name>
<param-value>icefaces</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.checkJavaScript</param-name>
<param-value>false</param-value>
</context-param>
4

1 回答 1

0

当我将 javax.faces.PROJECT_STAGE 设置为 Development 时,使用 mojarra 会出现这样的错误。如果您有此设置,请将其更改为生产并查看错误是否消失。

我虽然它是已知的错误,但找不到任何东西。

于 2012-04-09T21:15:40.540 回答