当前位置: 代码迷 >> Java Web开发 >> 404异常 The requested resource (/tp/HandleUpload) is not available.是什么有关问题
  详细解决方案

404异常 The requested resource (/tp/HandleUpload) is not available.是什么有关问题

热度:558   发布时间:2016-04-12 22:45:42.0
404错误 The requested resource (/tp/HandleUpload) is not available.是什么问题
web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" 
xmlns="http://java.sun.com/xml/ns/javaee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
  <servlet>
    <description>This is the description of my J2EE component</description>
    <display-name>This is the display name of my J2EE component</display-name>
    <servlet-name>HandleUpload</servlet-name>
    <servlet-class>myservlet.control.HandleUpload</servlet-class>
  </servlet>

  <servlet-mapping>
    <servlet-name>HandleUpload</servlet-name>
    <url-pattern>/servlet/HandleUpload</url-pattern>
  </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

访问路径:
http://localhost:8080/tp/HandleUpload


servlet:
HandleUpload.java:
package myservlet.control;
import mybean.data.*;
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class HandleUpload extends HttpServlet{
   public void init(ServletConfig config) throws ServletException{
      super.init(config);
      try{  
           Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
      }
      catch(Exception e){} 
   }
   
   public  void  doPost(HttpServletRequest request,HttpServletResponse response) 
                        throws ServletException,IOException{
      HttpSession session=request.getSession(true);
   }
   
   public void uploadFileMethod(HttpServletRequest request,
                              HttpServletResponse response,String logname)
  相关解决方案