Upload File vs IE 6.0
I am using NetBeans 5.5 with Tomcat 5.5.17 integrated, I am running an web application using the integrated tomcat.
Here is all the file of the web application
Upload.jsp
==========
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<FORM encType="multipart/form-data" method="post" action="/TestProject1/testServlet/uploadItem">
<input type="file" name="fileUpload"/>
<input name="submit2" type="submit" value="Submit"/>
</FORM>
</body>
</html>
index.jsp
========
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Home Page</h1>
</body>
</html>
Web.xml
=======
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
<servlet-name>testServlet</servlet-name>
<servlet-class>servlet.TestServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>testServlet</servlet-name>
<url-pattern>/testServlet/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>
index.jsp
</welcome-file>
</welcome-file-list>
</web-app>
TestServlet.java
================
package servlet;
import java.io.*;
import java.net.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class TestServlet extends HttpServlet {
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
RequestDispatcher dispatcher=null;
ServletContext servletContext = getServletContext();
HttpSession session=request.getSession();
boolean genForward=true;
String page = request.getPathInfo();
page= page.substring(1);
if("uploadItem".equals(page)){
System.out.println("get Here");
response.sendRedirect("/TestProject1/index.jsp");
return;
}
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
public String getServletInfo() {
return "Short description";
}
}
Now what I do is open the upload.jsp in browser, and click submit, and I expect it to return me the index.jsp pages
In Firefox 2.0 and Internet Explorer 7, it works perfectly ok.
I only get problem with Internet Explorer 6, I get "cannot find server" page as return.
I examine the server log, and discover that the "get Here" does printed in the server log. (Please refer the TestServlet.java for the System.out.println("getHere");)
Line that cause problem for IE 6.0 is
<input type="file" name="fileUpload"/> in upload.jsp
When I delete that line, it successfully return me the index.jsp pages.
What is the problem and how to correct it?

