Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

fileUpload problem: <h:form enctype="multipart/form-data"> problem

843842Jun 17 2006 — edited Jun 2 2008
I am trying to use common jakarta's fileUpload tag. I did everything like was told in the Core Java Server Faces book ("How do I support file uploads?" -at the end of the book) My problem is, that if only I input <h:form enctype="multipart/form-data"> in uploadImage.jsp file, click in submit commandButton only reloads that page (not loading submitted.jsp page, as it is supposed to. I was debbuging that code, and found out that "UploadFilter.java" isn't executed at all when I use multipart/form-data enctype. If I use default enctype (without that attribute) UploadFilter class code executes and "submitted.jsp" is loaded, but of course (I know that shouldn't work, but I just tried even this in despair) upload is unsuccessful (instruction:
FileItem item = (FileItem) request.getAttribute(clientId);
in UploadRendered.java writes null to the item) Has anybody had similar problem? Tag is, example as well, but I still can't make it work:/ I use NetBeans 5.0 and JSF 1.1 (book example is for JSF1.0 if it means something)
I suppose majority of you (who used that tag) know that example so I won't put the code here (book authors rights could be a problem too).
But I insert at least exact files structure:
web/
META-INF/
context.xml
WEB-INF/
classes/com/corejsf
UploadFilter.java
UploadRenderer.java
UploadTag.java
UserBean.java
util/
Tags.java
lib/
commons-fileupload-1.0.jar (and JSF jars)
faces-config.xml
upload.tld
web.xml
upload/
uploadImage.jsp
default.jsp
index.jsp //<jsp:forwad/> to default.jsp
submitted.jsp

//location of uploadImage.jsp file in upload or in WEB-INF folder (with appriopiate change in filter in web.xml) makes no difference

Please for any suggestions, thanks in advance, bye.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 30 2008
Added on Jun 17 2006
15 comments
2,873 views