wood burning stoves 2.0*
The moose likes Servlets and the fly likes mutipart/form-data Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "mutipart/form-data" Watch "mutipart/form-data" New topic
Author

mutipart/form-data

Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
I have html form element with ENCTYPE="MULTIPART/FORM-DATA"
that is

I couldn't able to read the values of the parameter action,id using request.getParameter(..) method,
please tell me how to capture that values ?
Regards
Balaji


Spritle Software Blogs
George Joseph
Greenhorn

Joined: Nov 05, 2001
Posts: 24
Hi Balaji,
In case of MULTIPART/FORM-DATA the request parameters can only be read after saving the file, using JspSmartUpload or other 3rd Party softwares.

But if you need to read values before saving the file then there is one tricky method. Set all the parmeters as query string which you need to access using request.getParameter("parma#").
Note for this you must change your form action as
"servlet/controllerServlet?param1=value1&param2=value2&param3=value3"

Hope this will answer your query.

George Joseph,
Product Development Group,
Transversal e Networks
[ November 08, 2002: Message edited by: George Joseph ]
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Originally posted by George Joseph:
Hi Balaji,
But if you need to read values before saving the file then there is one tricky method. Set all the parmeters as query string which you need to access using request.getParameter("parma#").
Note for this you must change your form action as
"servlet/controllerServlet?param1=value1&param2=value2&param3=value3"
George Joseph,
Product Development Group,
Transversal e Networks
[ November 08, 2002: Message edited by: George Joseph ]

Unfortunately!. Its not possible for my case where i have to get the input typed by the user.
In my case the user will select a particular language,then type his/her id,then select the file to upload.
Please help with this scenario ?
Regards
Balaji
George Joseph
Greenhorn

Joined: Nov 05, 2001
Posts: 24
Originally posted by Balaji Loganathan:

Unfortunately!. Its not possible for my case where i have to get the input typed by the user.
In my case the user will select a particular language,then type his/her id,then select the file to upload.
Please help with this scenario ?
Regards
Balaji


Hi Balaji
Then you will have to use JspSmartUpload or other 3rd Party softwares.
You can download JspSmartUpload from JspSmart
The code is something like this


George Joseph,
Product Development Group,
Transversal e Networks
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Thanks George,
It did the job finely.
thanks again.
Regards
Balaji
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: mutipart/form-data