日期:2014-05-18  浏览次数:20610 次

HTTP Status 404 - /denglu/Men_Servlet.do
这个是错误
HTTP Status 404 - /denglu/Men_Servlet.do

--------------------------------------------

type Status report

message /denglu/Men_Servlet.do

description The requested resource (/denglu/Men_Servlet.do) is not available.


--------------------------------------------

Apache Tomcat/5.5.16



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>Servlet</servlet-name>
<servlet-class>cn.hmj.servlet.Servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Servlet</servlet-name>
<url-pattern>/Servlet.do</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>Man_Servlet</servlet-name>
<servlet-class>cn.hmj.servlet.Man_Servlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Man_Servlet</servlet-name>
<url-pattern>/Man_Servlet.do</url-pattern>
</servlet-mapping>
</web-app>


java

public void addStudent(User user) {

try {

db = new Dbconn();
stmt = db.getConn().createStatement();
String sql = "inser into student" + " values('"+ user.getUsername()+ "' , '" + user.getPassword()+ "' , '" + user.getUserclass() + "')";

stmt.executeUpdate(sql);

} catch (Exception e) {
e.printStackTrace();
}

finally {

try {
stmt.close();
db.getConn();
} catch (Exception e) {
e.printStackTrace();
}

}
}

servlet

else if (method.equals("doaddStudent")) {

User user = new User();
user.setUsername(request.getParameter("studentName")) ;
user.setPassword(request.getParameter("studentPassword"));
user.setUserclass(request.getParameter("studentClass"));

man_dao.addStudent(user);

request.getRequestDispatcher("Servlet.do?method=managerId")
.forward(request, response);

}

------解决方案--------------------
404
找不到资源错误
配置没配好吧?
------解决方案--------------------
Men_Servlet.do Man_Servlet.do