File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes ContentType value coming as null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "ContentType value coming as null" Watch "ContentType value coming as null" New topic

ContentType value coming as null

srikanth sankurthi

Joined: Oct 09, 2012
Posts: 9
contentType value is coming as null in fileprocess.jsp.

<%@ page language="java" contentType="multipart/form-data; charset=ISO-8859-1"
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">
<title>File Upload</title>

<form name="fform" action="fileprocess.jsp">
Upload File:<input type="file"/>
<input type="submit" value="submit"/>



String contentType = request.getContentType();
out.println("contentType "+contentType);
Marc Peabody
pie sneak

Joined: Feb 05, 2003
Posts: 4727

The JSP page directive sets the contentType of the response. You're inspecting the contentType of the request.

A good workman is known by his tools.
wood burning stoves
subject: ContentType value coming as null