Java JSF:使用Icefaces组件上传文件时出现问题
我正在尝试使用Icefaces获得Java JSF:使用Icefaces组件上传文件时出现问题,java,jsf,file-upload,jsf-2,icefaces,Java,Jsf,File Upload,Jsf 2,Icefaces,我正在尝试使用Icefaces获得FileUpload功能,但服务器上未调用我的fileUploadListener,代码如下: xhtml片段: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ace="http://www.icefaces.org/icefaces/components" xmlns:ice-cc="htt
FileUpload
功能,但服务器上未调用我的fileUploadListener
,代码如下:
xhtml片段:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:ice-cc="http://www.icesoft.com/icefaces-composite-comps"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<link rel="stylesheet" type="text/css" href="/xmlhttp/css/rime/rime.css"/>
</h:head>
<h:body>
<h:form enctype="multipart/form-data">
<ace:fileEntry id="fileEntryComp"
label="File Entry"
relativePath="uploaded"
fileEntryListener="#{fileUpload.uploadFile}"/>
<h:commandButton value="Upload File"/>
</h:form>
</h:body>
</html>
FINE lifecycle - Entering RestoreViewPhase
FINE lifecycle - New request: creating a view for /trade_entry/UploadBlotter.xhtml
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - Created component with component type of 'javax.faces.ViewRoot'
FINE application - Created new view for /trade_entry/UploadBlotter.xhtml
FINE application - RenderKitId for this view as determined by calculateRenderKitId HTML_BASIC
FINE lifecycle - Exiting RestoreViewPhase
FINE timing - [TIMING] - [2ms] : Execution time for phase (including any PhaseListeners) -> RESTORE_VIEW 1
FINE lifecycle - render(com.sun.faces.context.FacesContextImpl@1dc6429)
FINE lifecycle - Entering RenderResponsePhase
FINE lifecycle - About to render view /trade_entry/UploadBlotter.xhtml
FINE application - Building View: /trade_entry/UploadBlotter.xhtml
FINE application - Created component with component type of 'javax.faces.Output'
FINE component - /trade_entry/UploadBlotter.xhtml @7,9 <h:head> Component[-1351329185_508ba5ae] Created: javax
.faces.component.UIOutput
FINE application - Created component with component type of 'javax.faces.Output'
FINE component - /trade_entry/UploadBlotter.xhtml @10,9 <h:body> Component[-1351329185_508ba588] Created: java
x.faces.component.UIOutput
FINE application - Created component with component type of 'javax.faces.HtmlForm'
FINE component - /trade_entry/UploadBlotter.xhtml @11,13 <h:form> Component[-1351329185_508ba5e2] Created: jav
ax.faces.component.html.HtmlForm
FINE application - Created component with component type of 'org.icefaces.ace.component.FileEntry'
FINE application - Created component with component type of 'javax.faces.Output'
FINE application - Created component with component type of 'javax.faces.ComponentResourceContainer'
FINE application - Created component with component type of 'javax.faces.Output'
FINE application - Created component with component type of 'javax.faces.Output'
FINE component - /trade_entry/UploadBlotter.xhtml @15,70 <ace:fileEntry> Component[-1351329185_508ba5fc] Creat
ed: org.icefaces.ace.component.fileentry.FileEntry
FINE application - Created component with component type of 'javax.faces.HtmlCommandButton'
FINE component - /trade_entry/UploadBlotter.xhtml @16,47 <h:commandButton> Component[-1351329185_508ba5c9] Cre
ated: javax.faces.component.html.HtmlCommandButton
FINE application - Created component with component type of 'javax.faces.ComponentResourceContainer'
FINE component - No renderer-type for component j_id1
FINE component - No renderer-type for component javax_faces_location_BODY
FINE application - Rendering View: /trade_entry/UploadBlotter.xhtml
FINE component - No renderer-type for component javax_faces_location_HEAD
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE component - No renderer-type for component _captureFileOnsubmit
FINE application - Begin writing marker for viewId /trade_entry/UploadBlotter.xhtml
FINE application - End writing marker for viewId /trade_entry/UploadBlotter.xhtml
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - Begin writing marker for viewId /trade_entry/UploadBlotter.xhtml
FINE application - End writing marker for viewId /trade_entry/UploadBlotter.xhtml
FINE lifecycle - Exiting RenderResponsePhase
日志信息:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:ice-cc="http://www.icesoft.com/icefaces-composite-comps"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<link rel="stylesheet" type="text/css" href="/xmlhttp/css/rime/rime.css"/>
</h:head>
<h:body>
<h:form enctype="multipart/form-data">
<ace:fileEntry id="fileEntryComp"
label="File Entry"
relativePath="uploaded"
fileEntryListener="#{fileUpload.uploadFile}"/>
<h:commandButton value="Upload File"/>
</h:form>
</h:body>
</html>
FINE lifecycle - Entering RestoreViewPhase
FINE lifecycle - New request: creating a view for /trade_entry/UploadBlotter.xhtml
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - Created component with component type of 'javax.faces.ViewRoot'
FINE application - Created new view for /trade_entry/UploadBlotter.xhtml
FINE application - RenderKitId for this view as determined by calculateRenderKitId HTML_BASIC
FINE lifecycle - Exiting RestoreViewPhase
FINE timing - [TIMING] - [2ms] : Execution time for phase (including any PhaseListeners) -> RESTORE_VIEW 1
FINE lifecycle - render(com.sun.faces.context.FacesContextImpl@1dc6429)
FINE lifecycle - Entering RenderResponsePhase
FINE lifecycle - About to render view /trade_entry/UploadBlotter.xhtml
FINE application - Building View: /trade_entry/UploadBlotter.xhtml
FINE application - Created component with component type of 'javax.faces.Output'
FINE component - /trade_entry/UploadBlotter.xhtml @7,9 <h:head> Component[-1351329185_508ba5ae] Created: javax
.faces.component.UIOutput
FINE application - Created component with component type of 'javax.faces.Output'
FINE component - /trade_entry/UploadBlotter.xhtml @10,9 <h:body> Component[-1351329185_508ba588] Created: java
x.faces.component.UIOutput
FINE application - Created component with component type of 'javax.faces.HtmlForm'
FINE component - /trade_entry/UploadBlotter.xhtml @11,13 <h:form> Component[-1351329185_508ba5e2] Created: jav
ax.faces.component.html.HtmlForm
FINE application - Created component with component type of 'org.icefaces.ace.component.FileEntry'
FINE application - Created component with component type of 'javax.faces.Output'
FINE application - Created component with component type of 'javax.faces.ComponentResourceContainer'
FINE application - Created component with component type of 'javax.faces.Output'
FINE application - Created component with component type of 'javax.faces.Output'
FINE component - /trade_entry/UploadBlotter.xhtml @15,70 <ace:fileEntry> Component[-1351329185_508ba5fc] Creat
ed: org.icefaces.ace.component.fileentry.FileEntry
FINE application - Created component with component type of 'javax.faces.HtmlCommandButton'
FINE component - /trade_entry/UploadBlotter.xhtml @16,47 <h:commandButton> Component[-1351329185_508ba5c9] Cre
ated: javax.faces.component.html.HtmlCommandButton
FINE application - Created component with component type of 'javax.faces.ComponentResourceContainer'
FINE component - No renderer-type for component j_id1
FINE component - No renderer-type for component javax_faces_location_BODY
FINE application - Rendering View: /trade_entry/UploadBlotter.xhtml
FINE component - No renderer-type for component javax_faces_location_HEAD
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE component - No renderer-type for component _captureFileOnsubmit
FINE application - Begin writing marker for viewId /trade_entry/UploadBlotter.xhtml
FINE application - End writing marker for viewId /trade_entry/UploadBlotter.xhtml
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - URL pattern of the FacesServlet executing the current request .jsp
FINE application - Begin writing marker for viewId /trade_entry/UploadBlotter.xhtml
FINE application - End writing marker for viewId /trade_entry/UploadBlotter.xhtml
FINE lifecycle - Exiting RenderResponsePhase
我没有看到组件周围有任何
,代码中有吗?
我没有冰面方面的经验,但我已经习惯了。
带着
它需要装在一个盒子里
<h:form id="paramsForm" enctype="multipart/form-data">
文件上传需要多部分/表单数据enctype大多数情况下未关闭的标签会导致该异常。检查xhtml,您可能会找到任何打开的标记
e、 g:任何打开的div或span..从
h:form
中删除enctype=“multipart/form data”
,如果没有它,应该可以正常工作。我在JBoss 7.1服务器上遇到了这个问题。我有一个EAR项目,一些EJB项目和几个WAR项目。当我遇到问题时,我在EAR库中部署了icefaces罐子,但是当我把他们转移到使用ace:fileentry的WAR项目时,它开始工作。我使用的是
而不是
你能给你的ice:form添加一个enctype吗?使用了enctype,但它没有做任何更改。如果你的fileUploadListener
调用的很好,没有任何问题吗?这从昨天开始就给我带来了真正的痛苦。现在事情是这样的,我在服务器日志中没有看到任何东西,调试器也没有点击fileUploadListener
。我有完全相同的问题,我的fileEntryListener从未被调用,您是否得到任何其他结果,或者切换到richfaces是唯一的选项?不,这不是这里的问题,此外,此异常本质上是随机的,与包含的一个css文件相关,如果我删除该文件,则不会出现此异常。我已尝试从h:form
中删除enctype
,但仍然无法正常工作,您能否发布完整的工作示例,以便我可以验证导致此问题的原因,这是真正的痛苦。
<h:form id="paramsForm" enctype="multipart/form-data">