David Delbecq wrote:
Hi David and thanks for the reply,If you want to keep the filepath in the form presented to user, it's impossible. This is because for security reason it's impossible in HTML to initialize a fileupload field. (Imagine a hidden file upload field which send user confidnetial datas to a malicious server...). However, the fileupload UIComponent keep it's internal value after the form is reshown. I think if you don't upload a new value, the component will use the old one. The problem is that the UploadedFile attribute is set to null, as the form is reshown. And if I don't upload a new value nothing is uploaded. Is there any other way to obtain the component's internal value you mentioned? I also found this: ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ Saving upload despite any validation errors In many cases you will want to save the uploaded file, even if there are validation errors. Otherwise the user must upload the file again, which is annoying and may be very time-consuming. To do that, don't value-bind the component to a backing bean, but use a ValueChangeListener and set immediate="true". <t:inputFileUpload storage="file" immediate="true">
<f:valueChangeListener type="com.myorg.foo.UploadListener" />
</t:inputFileUpload>
public class UploadListener implements ValueChangeListener {
public void processValueChange(ValueChangeEvent event) throws AbortProcessingException {
UploadedFile uploadedFile = (UploadedFile) event.getNewValue();
// do something with uploadedFile
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------But the problem is that the user won't see (when the page is reshown) the path of the file that will be uploaded. Regards, Elenh. |
- AW: AW: Two faces config files in one war Pfau, Oliver
- question on : How do I prevent reset of file path in &l... Eleni Tsigka
- Re: question on : How do I prevent reset of file pa... Eleni Tsigka
- Re: question on : How do I prevent reset of fil... David Delbecq
- Re: question on : How do I prevent reset of... Eleni Tsigka
- Re: question on : How do I prevent res... David Delbecq
- Re: question on : How do I prevent... Eleni Tsigka
- Re: question on : How do I pre... David Delbecq

