【问题标题】:Primefaces fileUploadListener is not invoking with websphere 8.5Primefaces fileUploadListener 未使用 websphere 8.5 调用
【发布时间】:2014-06-06 20:37:56
【问题描述】:

我正在使用 primefaces 4.0、JSF 2.2。 FileUpload 正在使用 Apache Tomcat 7.0 但 fileUploadListener 没有使用 websphere 8.5 调用。 日志中没有异常。

解决方案在 Tomcat 7.0 上运行良好 组件是完整注册表的一部分。我在表格中使用和不使用 enctype="multipart/form-data" 进行了检查。问题依旧。

文件上传组件:

<p:fileUpload auto="true"
fileUploadListener="#{PatientRegistrationBean.uploadFile}"
mode="advanced" dragDropSupport="false" update="uploadedFile1"   
sizeLimit="100000" fileLimit="10" allowTypes="/(\.|\/)(gif|jpe?g|png)$/">
</p:fileUpload>

命令按钮:

<p:commandButton id="btnSave2" value="Save" process="@form" update="@form"
action="#{PatientRegistrationBean.savePatient}" >
</p:commandButton>

我已经在 primefaces 论坛上发布了这个问题,但迄今为止没有答案。

我已完成 web.xml 中所需的所有设置。并且解决方案在 apache tamcat 7.0 上运行良好。

问题已解决。我只是将过滤器配置放在web.xml中的servlet配置之前,问题就解决了。 :)

【问题讨论】:

  • 您是否在 web.xml 中为 PrimeFace FileUpload 提供了 &lt;context-param&gt; 条目?
  • 检查您的服务器日志/浏览器开发者控制台(尤其是网络选项卡)是否有任何错误。还要确保您没有在 websphere 安装中复制 JSF jar
  • @kolossus 没有 jar 冲突
  • @Diganta 所有配置都可以。因为解决方案在 tomcat 7.0 上运行良好
  • @BalusC 请调查一下。

标签: tomcat file-upload jsf-2 primefaces websphere


【解决方案1】:

我遇到了同样的问题,我修复了将 enctype="multipart/form-data" 添加到表单 (h:form) 并将以下行添加到 web.xml 中的 JSF Servlet conf 的问题。

<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
<multipart-config>
    <max-file-size>20848820</max-file-size>
    <max-request-size>418018841</max-request-size>
    <file-size-threshold>1048576</file-size-threshold>
</multipart-config>
</servlet>

此解决方案也适用于 JSF 2.2 h:fileUpload

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-04-08
    • 2011-10-28
    • 1970-01-01
    • 2014-03-01
    • 2016-06-17
    • 1970-01-01
    • 1970-01-01
    • 2013-08-01
    相关资源
    最近更新 更多