JSF IllegalException:组件ID形式:在视图中已找到`xyz`

时间:2012-04-09 20:31:03

标签: jsf file-upload icefaces

我得到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功能正常工作,奇怪的是,javascript文件夹中存在的cssjavax.faces.resources内容未在应用程序中引用所以我得到了一些奇怪的错误。

另外需要注意的是,如果我将eclipseicefaces插件一起使用,那么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>

1 个答案:

答案 0 :(得分:0)

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

我虽然知道bug但却找不到任何东西。