aarschie
asked on
getContentType is returning null
Hi,
I am calling a servlet from a JSP.
WHen I try to check the content type from the request paramente, I get null returned.
How can I set it to "multipart/form-data""
My JSP which is calling the servlet has enctype="multipart/form-da ta"
Can somebody let me know what I am doing wrong here.
Thanks
Arschie
I am calling a servlet from a JSP.
WHen I try to check the content type from the request paramente, I get null returned.
How can I set it to "multipart/form-data""
My JSP which is calling the servlet has enctype="multipart/form-da
Can somebody let me know what I am doing wrong here.
Thanks
Arschie
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
post your code if you still have problem.
it returnl null, because your ServletContainer don't know how to parse multipart/form-data
so, you need a good library to work with it. Try to use jakarta commons/fileupload - it's perfect.
you can find it on:
http://jakarta.apache.org/commons/fileupload/index.html
so, you need a good library to work with it. Try to use jakarta commons/fileupload - it's perfect.
you can find it on:
http://jakarta.apache.org/commons/fileupload/index.html
>> it returnl null, because your ServletContainer don't know how to parse multipart/form-data
Content type is sent from browser as http header entry, servlet container should not change it by contract. so it's not the issue of whether container knows how to handle a certain content type or not. my sample code clearly shows that container does pass down the content type.
>> Try to use jakarta commons/fileupload - it's perfect.
Yes, this will help to get the form data and uploaded file. another good one is jspsmartupload from www.jspsmart.com
Content type is sent from browser as http header entry, servlet container should not change it by contract. so it's not the issue of whether container knows how to handle a certain content type or not. my sample code clearly shows that container does pass down the content type.
>> Try to use jakarta commons/fileupload - it's perfect.
Yes, this will help to get the form data and uploaded file. another good one is jspsmartupload from www.jspsmart.com