Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/324.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何设置ICEfaces ice:inputFile文件名验证错误的消息?_Java_Jsf_Icefaces_Messages - Fatal编程技术网

Java 如何设置ICEfaces ice:inputFile文件名验证错误的消息?

Java 如何设置ICEfaces ice:inputFile文件名验证错误的消息?,java,jsf,icefaces,messages,Java,Jsf,Icefaces,Messages,设置:IceFaces1.8.2,JavaEE5,JSF1.2 我使用了一个ice:inputFile标签来允许用户上传PDF文件,并使用了一个ice:messages标签来向用户提供错误反馈: <ice:inputFile fileNamePattern=".+\.pdf" uniqueFolder="false" uploadDirectory="#{FileController.fileUploadDirectory}" uploadDirectoryAbsolute="true"

设置:IceFaces1.8.2,JavaEE5,JSF1.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\u im\u not\u a\u pdf.rtf”与文件名模式“+\.pdf”不匹配

我该如何用更好的信息替换该信息?我曾尝试在网上搜索,并在ice:inputFile上设置一个名为“converterMessage”的属性,但这两个属性的工作方式都不一样

谢谢。


您必须创建属性文件,并在其中定义:

com.icesoft.faces.component.inputfile.INVALID_NAME_PATTERN=The file name \''{0}\'' does not match with the file name pattern \''{1}\''
请参阅ICEFaces中的messages.properties以了解您可能要替换的其他错误消息。

请参阅
您必须创建属性文件,并在其中定义:

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

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

您可以在备份bean中使用validate,并在上载操作中相应地设置消息。这个链接可能很有用-您可以在backingbean中使用validate,并在上传操作中相应地设置消息。这个链接可能有用-