Boa Noite,
Estou fazendo uma pagina apenas em JSP criei uma pagina de login com suas devidas validações, apenas não consegui fazer o seguinte, quando é colocado o usuário e senha caso estejam errados aparece uma mensagem notificando o erro e fica na pagina de login. No meu caso ele informa que o usuário está errado mais em outra pagina. Oque fazer para fazer que quando o usuario esteja errado ficar na pagina de login e não ir para a outra??
Paginas index.jsp
<%@page contentType=“text/html”%>
<%@page pageEncoding=“UTF-8”%>
<%–
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library… action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
–%>
<%–
<%@taglib uri=“http://java.sun.com/jsp/jstl/core” prefix=“c”%>
–%>
</style>
Agenda Virtual |
Usuário: |
Senha: |
|
|
Cadastra-se |
Pagina teste.jsp
<%<a class="mention" href="/u/page">@page</a> contentType=“text/html”%>
<%<a class="mention" href="/u/page">@page</a> pageEncoding=“UTF-8”%>
<%<a class="mention" href="/u/page">@page</a> import=“Conexao.DBServices” %>
<%–
The taglib directive below imports the JSTL library. If you uncomment it,
you must also add the JSTL library to the project. The Add Library… action
on Libraries node in Projects view can be used to add the JSTL 1.1 library.
–%>
<%–
<%@taglib uri=“<a href="http://java.sun.com/jsp/jstl/core">http://java.sun.com/jsp/jstl/core</a>” prefix=“c”%>
–%>
</head>
<body>
<%
String tfUsuario = request.getParameter("tfUsuario");
String tfSenha = request.getParameter("tfSenha");
DBServices dbs = new DBServices("agenavirtual",USUARIO,SENHA;
dbs.getConnection();
dbs.execSQL("QUERY", "SELECT 1 FROM usuarios WHERE nome = '"+ tfUsuario +"' AND senha = '"+ tfSenha +"' ");
if(dbs.getRs().next()) {
%>
with (document.form1) {
alert(“USUARIO OK”);
}
}
<%
}
else {
%>
with (document.form1) {
alert(“USUARIO E SENHA INCORRETO”);
}
<%
}
dbs.destroySQL();
dbs.closeConnection();
%>
</body>
Oque fazer para fazer a validação?