views:

185

answers:

1

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.

+1  A: 

See http://www.icefaces.org/JForum/posts/list/9528.page#39677
You have to create a properties file, and in it define:

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

See the messages.properties in ICEFaces for other error messages you may want to replace.

Adam