剛開始是這樣的
後來又刷新了一遍
我已經快瘋了,網上說是類名不對,可是我的是對的啊
package MyServelet;
import java.io.IOException;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
public class MyFirstServelet implements Servlet
{
@Override
public void destroy() {
// TODO Auto-generated method stub
System.out.println("destroy");
}
@Override
public ServletConfig getServletConfig() {
// TODO Auto-generated method stub
System.out.println("getServletConfig");
return null;
}
@Override
public String getServletInfo() {
// TODO Auto-generated method stub
System.out.println("getServletInfo");
return null;
}
@Override
public void init(ServletConfig arg0) throws ServletException {
// TODO Auto-generated method stub
System.out.println("init");
}
@Override
public void service(ServletRequest arg0, ServletResponse arg1) throws ServletException, IOException {
// TODO Auto-generated method stub
System.out.println("service");
}
public MyFirstServelet()
{
System.out.println("我成功了。。。。。");
}
}
<?xml version="1.0" encoding="UTF-8"?>
hello
<servlet-class>MyServelet.MyFirstServelet</servlet-class>
hello
/happy
項目clean下,可能是編譯類文件沒有發布過去。