wood burning stoves 2.0*
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
JavaRanch » Java Forums » Java » JSP
Bookmark "ContentType value coming as null" Watch "ContentType value coming as null" New topic
Author

ContentType value coming as null

srikanth sankurthi
Greenhorn

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

fupload.jsp
=======
<%@ page language="java" contentType="multipart/form-data; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>File Upload</title>
</head>

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

</html>

fileprocess.jsp
============

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

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: http://aspose.com/file-tools
 
subject: ContentType value coming as null
 
Similar Threads
values are not getting transferred from one servlet to another servlet
Browser support for uploading file
include directive doesn't work
Not able to set attribute in JSP
Browse- need full file path