Organizational Research By

Surprising Reserch Topic

convenient way to parse incoming multipart form data parameters in a servlet


convenient way to parse incoming multipart form data parameters in a servlet  using -'Is,there,any,convenient,way,to,read,and,parse,data,from,incoming,request.

E.g,client,initiate,post,request

URLConnection,connection,=,new,URL(url).openConnection();
connection.setDoOutput(true);
connection.setRequestProperty("Content-Type",,"multipart/form-data;,boundary=",+,boundary);
PrintWriter,writer,=,null;
try,{
,,,,OutputStream,output,=,connection.getOutputStream();
,,,,writer,=,new,PrintWriter(new,OutputStreamWriter(output,,charset),,true);,//,true,=,autoFlush,,important!
,,,,//,Send,normal,param.
,,,,writer.println("--",+,boundary);
,,,,writer.println("Content-Disposition:,form-data;,name=\"param\"");
,,,,writer.println("Content-Type:,text/plain;,charset=",+,charset);
,,,,writer.println();
,,,,writer.println(param);

I’m,not,able,to,get,param,using,request.getParameter("paramName").,The,following,code

BufferedReader,reader,=,new,BufferedReader(new,InputStreamReader(
,,,,request.getInputStream()));
,,StringBuilder,sb,=,new,StringBuilder();
,,for,(String,line;,(line,=,reader.readLine()),!=,null;),{
,,,System.out.println(line);

,,}
asked Sep 21, 2015 by mannumits1
edited Sep 21, 2015 by rajesh
0 votes
9 views



Related Hot Questions



Government Jobs Opening


...