Upload Files with JSF and MyFaces

the jsf tag that is used to place a component in jsp page is:

<t:inputFileUpload id="fileId"

value="#{uploadBean.uploadedFile}"

storage="file"/>

Usually, when you bind some component(for example input field) with a property and a page is redisplayed you don't lose the value entered.

But I can not understand one thing with this t:inputFileUpload element. It is displayed like two fields: a button and an input field. And there is no way to bind the value of the input field with some property, so when the page is redisplayed I don't lose the path value entered.

Do you think this can be done somehow, without opening the library and make changes in it?

[784 byte] By [cheltsova] at [2007-11-27 4:41:12]
# 1

This is normal behaviour of a <input type="file"> element.

If you actually want to change it, then you may need to write your own component which renders a hidden input type="file" element and visible input type="text" and input type="button" elements, which will map the value to the hidden element onsubmit.

BalusCa at 2007-7-12 9:52:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

10x for you suggestion.

Ok, i have one more question. MyFaces is using filter to remove files bigger than 7MB. This is working fine, but I can not understand if there is a way for my jsf page to understand if there was an attempt to upload a file bigger than 10MB, so I can display appropriate message. It seems like these are different layers and I can not figure out if there is a way to do this.

cheltsova at 2007-7-12 9:52:31 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...