This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
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 this week in the OCAJP 8 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.
I agree. Here's the link:
subject: ContentType value coming as null
It's not a secret anymore!