0
I’m having a problem with this Servlet, when I start with Tomcat error 404 appears and displays the following message "The requested Resource [/test/Novaempresa] is not available".
JSP
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form method="post" action="NovaEmpresa">
<label>Nome da empresa:</label>
<input type="text" name="nome"/>
<button type="submit">Enviar</button>
</form>
</body>
</html>
Servlet
package teste;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/NovaEmpresa")
public class NovaEmpresa extends HttpServlet{
protected void service(HttpServletRequest request, HttpServletResponse response) {
System.out.println("teste!!!!");
}
}
Very common mistake, could be several possibilities. I was going to ask for more details (Tomcat version, folder structure, configuration file) but maybe this can serve as a canonical question for the problem. See (English): https://stackoverflow.com/q/15545950/2241463
– Piovezan
When it starts the server, your IDE creates a log, puts the log there for us to see.
– slyfer