無論我做什麼,都無法運行maven servlet。如果我重新啓動服務器,生病得到一個錯誤:maven servlet HTTP狀態404 -
HTTP Status 500 - Error instantiating servlet ---
如果我重新啓動頁面,無需重新啓動服務器 - 生病得到
HTTP Status 404 -
有Maven項目結構。
web.xml中:
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd" >
<web-app>
<display-name>Archetype Created Web Application</display-name>
<servlet>
<servlet-name>Cezar</servlet-name>
<display-name>Cezar</display-name>
<description></description>
<servlet-class>Cezar</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Cezar</servlet-name>
<url-pattern>/Cezar</url-pattern>
</servlet-mapping>
</web-app>
Cezar.java:
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Cezar extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException{
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<body>");
out.println("<h1>Hello Servlet Get</h1>");
out.println("</body>");
out.println("</html>");
}
}
展開組件:
plz分享你的部署組裝details.Right在項目資源管理器中點擊你的web項目 - >選擇'屬性'。在項目屬性下,選擇「部署程序集」。 – Bikku