This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Other JSE/JEE APIs and the fly likes Java Mail Question... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java Mail Question..." Watch "Java Mail Question..." New topic

Java Mail Question...

Jack Daniel
Ranch Hand

Joined: Jun 15, 2002
Posts: 163
Hi everybody,..

Well, i have started writing an e-mail program, which is used for sending e-mail with attachments. Everything works fine, but in the <FORM> i did not include ENCTYPE = "multipart/form-data". In the documentation i see that it has to be included, but why?? when my application is running without this.

In case if i include ENCTYPE = "multipart/form-data" in the <FORM>, then the problem comes !! In the servlet any
is always returning null; in other words all the HTML FORM input parameters are null, when i read from servlet.
If i remove ENCTYPE = "multipart/form-data" from <FORM> tag, it is back to running good.

Can anybody shed more light on this <FORM ENCTYPE="multipart/form-data" >
I appreciate your help on this matter..
Thanks again..
Jack Daniel
Ranch Hand

Joined: Jun 15, 2002
Posts: 163
another point:

I use METHOD="post" in the <FORM> tag, so i do not know how
ENCTYPE = "multipart/form-data" is causing problem..

please share your opinion(s)
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

ENCTYPE = "multipart/form-data" is required if you want to post data other than text values - which you do if you want to upload attachements. For your Servlet to be able to understand this you'll need a request wrapper whcih can parse this content type. You might want to look at this.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Jack Daniel
Ranch Hand

Joined: Jun 15, 2002
Posts: 163
Thanks Paul
I agree. Here's the link:
subject: Java Mail Question...
It's not a secret anymore!