Olá tudo bem? Por favor, alguém pode me ajudar nesse curso, agarrei logo no inicio.
ao carregar o http://localhost:8080/gerenciadorweb/bem-vindo.html, funcioana blz.
O erro ocorre somente ao carregar o http://localhost:8080/gerenciadorweb/oi
HTTP Status 404 – Not Found
Type Status Report
Message /gerenciadorweb/oi
Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
Apache Tomcat/9.0.12
Classe Servlet está igual ao curso.
package br.com.alura.gerenciadorweb.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet(urlPatterns="/oi")
public class OiMundoServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
PrintWriter out = resp.getWriter();
out.println("<html>");
out.println("<body>");
out.println("oi mundo, parabens vc escreveu a primeira servlet.");
out.println("</body>");
out.println("</html>");
System.out.println("a servlet OiMundoServlet foi chamado");
}
}
Web.xml criado automaticamente.
<?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>gerenciadorweb</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>