Boa Tarde pessoal! Bem estou com o erro 404 numa atividade de estudo e não encontro erro algum na implementação
alguém pode me ajudar porque o referido erro ocorre aqui?
Estou estudando por um livro de desenvolvimento web e estou nos primeiros capítulos então peço ajuda de vocês vlw!
Página JSP
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Login</title>
</head>
<body>
<form action="TrabComPost" method="post">
Login: <input type="text" name="usuario"/> <br>
Senha: <input type="password" name="senha"/><br>
<input type="submit" value="Logar"/>
</form>
</body>
</html>
Servlet
package ServletPost;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class TrabComPost extends HttpServlet {
private static final long serialVersionUID = 1L;
public TrabComPost() {
super();
}
public void init(ServletConfig config) throws ServletException {
super.init();
}
public void destroy() {
super.destroy();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String usuario = request.getParameter("usuario");
String senha = request.getParameter("senha");
String html = "<html><head>" + "<title>Trabalhando com o Post com Servlet</title>" + "</head>" + "<body>";
if(usuario.equals("Edson")&&(senha.equals("123"))){
html += "Seja Bem-Vindo Edson";
}else{
html += "Usuario e Senha Inválidos";
}
html += "</body></html>";
response.setContentType("text/html");
PrintWriter writer = response.getWriter();
writer.print(html);
writer.close();
}
}