2010-08-18 59 views
1

安装程序:ICEfaces 1.8.2,Java EE 5,JSF 1.2。如何设置ICEfaces ice:inputFile文件名验证错误消息?

我使用冰:INPUTFILE标签允许用户上传PDF文件,并且冰:如果用户试图上传

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

:messages标签提供错误反馈给用户一个文件,其名称不以“.PDF”结束,冰:messages标签显示以下(神秘和用户敌对的)错误:

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

我将如何替换能有更好的消息?我尝试过搜索网页,并在ice上设置一个名为'converterMessage'的属性:inputFile,但这些都不像他们通常那样工作。

谢谢。

+1

您可以在上传操作中相应地使用支持bean中的验证和设置消息。这个链接可能很有用 - http://facestutorials.icefaces.org/tutorial/validators-tutorial.html – 2010-08-19 07:39:31

回答

1

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}\'' 

见messages.properties在ICEFaces的你可能需要更换其他错误消息。