0
I’m having the following eclipse error while running a Servlet:
HTTP Status 404 - /Testejsp/
web xml.
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>TesteJSP</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>Home Servlet</servlet-name>
<servlet-class>servlet.Home</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Home Servlet</servlet-name>
<url-pattern>/home</url-pattern>
</servlet-mapping>
</web-app>
Servlet
package servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Home extends HttpServlet{
private static final long serialVersionUID = 1L;
public Home() {
super();
}
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
super.doGet(req, resp);
PrintWriter out = resp.getWriter();
out.println("<html><head></head><body>Teste</body></html>");
out.close();
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
// TODO Auto-generated method stub
super.doPost(req, resp);
}
}
Obs I’m using Tomcat 7
Good afternoon. Have you set up the right Tomcat?? it appears in the server tab in the eclipse?? if this checks if it has been initialized, generally this error of when it is not initialized
– Julio Henrique
@Juliohenrique97 the Tomcat is normally initiating.
– William