如何设置 ICEfacesice:inputFile 文件名验证错误的消息?
设置: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 标签显示以下(神秘且对用户有敌意的)错误:
文件名“halp_im_not_a_pdf.rtf”与文件名模式“.+\.pdf”不匹配
如何用更好的内容替换该消息?我尝试在网上搜索并在ice:inputFile上设置一个名为“converterMessage”的属性,但这些都不像通常那样有效。
谢谢。
Setup: ICEfaces 1.8.2, Java EE 5, JSF 1.2.
I'm using an ice:inputFile tag to allow the user to upload a PDF file, and an ice:messages tag to provide error feedback to the user:
<ice:inputFile fileNamePattern=".+\.pdf" uniqueFolder="false" uploadDirectory="#{FileController.fileUploadDirectory}" uploadDirectoryAbsolute="true" actionListener="#{FileController.uploadActionListener}" submitOnUpload="preAndPostUpload" />
<!-- ... -->
<ice:messages />
If the user tries to upload a file whose name doesn't end with '.pdf', the ice:messages tag shows the following (cryptic and user-hostile) error:
The file name 'halp_im_not_a_pdf.rtf' does not match with the file name pattern '.+\.pdf'
How would I replace the message with something better? I've tried searching the Web and setting an attribute called 'converterMessage' on ice:inputFile, but neither of those worked like they usually do.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅http://www.icefaces.org/JForum/posts/list /9528.page#39677
您必须创建一个属性文件,并在其中定义:
请参阅 ICEFaces 中的 messages.properties 以获取您可能想要替换的其他错误消息。
See http://www.icefaces.org/JForum/posts/list/9528.page#39677
You have to create a properties file, and in it define:
See the messages.properties in ICEFaces for other error messages you may want to replace.