java - 如何设置 ICEfaces 冰 :inputFile filename validation error? 的消息

标签 java jsf icefaces message

设置:ICEfaces 1.8.2、Java EE 5、JSF 1.2。

我使用ice:inputFile标签来允许用户上传PDF文件,并使用ice:messages标签来向用户提供错误反馈:

<ice:inputFile fileNamePattern=".+\.pdf" uniqueFolder="false" uploadDirectory="#{FileController.fileUploadDirectory}" uploadDirectoryAbsolute="true" actionListener="#{FileController.uploadActionListener}" submitOnUpload="preAndPostUpload" />
<!-- ... -->
<ice:messages />

如果用户尝试上传名称不以“.pdf”结尾的文件,ice:messages 标记会显示以下(神秘且对用户不利的)错误:

The file name 'halp_im_not_a_pdf.rtf' does not match with the file name pattern '.+\.pdf'

如何用更好的内容替换该消息?我尝试在网络上搜索并在ice:inputFile上设置一个名为“converterMessage”的属性,但是这些都没有像平常那样工作。

谢谢。

最佳答案

参见http://www.icefaces.org/JForum/posts/list/9528.page#39677
您必须创建一个属性文件,并在其中定义:

com.icesoft.faces.component.inputfile.INVALID_NAME_PATTERN=The file name \''{0}\'' does not match with the file name pattern \''{1}\''

请参阅 ICEFaces 中的 messages.properties,了解您可能想要替换的其他错误消息。

关于java - 如何设置 ICEfaces 冰 :inputFile filename validation error? 的消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3516151/

相关文章:

java - Java中的显式类型转换示例

java - SharedPreference ClassCastException 问题 Android

java - 模拟 Spring 安全类

java - 在hibernate中,JSP值如何匹配实体类中的变量

java - 托管 bean 和 spring Controller 有什么区别?

java - Icefaces 1.8.2 中的整页刷新?

java - 服务器发起的渲染 : EJB -> FacesContext?

css - 通过 Sass 在 JSF 样式表资源中设置背景图像 URL

jsf - :commandScript - update h:panelGroup after push

java - JSF/ICEFaces 渲染响应时间很长