Urgent .....Getting Null pointer Exception
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   KrupaS_Katkar
Posted On:   Wednesday, August 26, 2009 02:35 AM

I want to upload file using servlet. Here is my code of servlet, on line "List items = upload.parseRequest(request);" i am getting null value for items Pl. help me out.... public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(CONTENT_TYPE); PrintWriter out = response.getWriter(); String optionalFileName=""; String fileName=""; boolean fileUpload=false; FileItem itm=null; boolean isMultipart = ServletFileUpload.isMultipartContent(request); System.out.println("request: "+request   More>>

I want to upload file using servlet.
Here is my code of servlet, on line

"List items = upload.parseRequest(request);"
i am getting null value for items
Pl. help me out....

			


public void doPost(HttpServletRequest request,
HttpServletResponse response) throws ServletException, IOException

{
response.setContentType(CONTENT_TYPE);
PrintWriter out = response.getWriter();

String optionalFileName="";
String fileName="";
boolean fileUpload=false;
FileItem itm=null;


boolean isMultipart = ServletFileUpload.isMultipartContent(request);
System.out.println("request: "+request);

if(!isMultipart)
{
}
else
{

FileItemFactory factory = new DiskFileItemFactory();
ServletFileUpload upload = new ServletFileUpload(factory);
//upload.setSizeMax(100000000);

try {
List items = upload.parseRequest(request);

System.out.println("Items are" +items);
Iterator itr = items.iterator();
FileItem itm1 = null;
...........
.............
   <<Less
About | Sitemap | Contact