Olá pessoal sou novo no fórum e novato no java.
Bom estou fazendo um formulário no jsp bem simples, só que esta dando erro na hora logar.
Já tentei mapear pelo web.xml e também pelas anotações só que o resultado é o mesmo.
olha ae o meu código
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<form action="primeiro" method="post">
Login:<input type="text" name="usuario"/>
Senha:<input type="text" name="senha"/>
<input type="submit" value="Logar"/>
</form>
</body>
</html>
o código da minha classe
package Logica;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author MachineKiller_PC
*/
@WebServlet(name="primeiro",value="/ola")
public class TestePost extends HttpServlet{
@Override
public void destroy(){
super.destroy();
}
@Override
public 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 post em Servlet </title>"+
"</head>"+
"<body>";
if(usuario.equals("Joao Ricardo")&& senha.equals("1234")){
html+="Seja bem vindo Joao Ricardo";
}else{
html+="Usuario e senha incorretos";
}
html+="</body></html>";
response.setContentType("text/html");
PrintWriter escreva=response.getWriter();
escreva.print(html);
escreva.close();
}
@Override
public void init() throws ServletException{
super.init();
}
}
esse é o erro que o servidor glassfish da.
HTTP Status 404 -
type Status report
message
descriptionThe requested resource () is not available.
GlassFish Server Open Source Edition 3.1.2.2