Tema: Ayuda
Ver Mensaje Individual
  #5 (permalink)  
Antiguo 18/01/2008, 11:55
BereLiz
 
Fecha de Ingreso: enero-2008
Mensajes: 20
Antigüedad: 16 años, 4 meses
Puntos: 0
Re: Ayuda

Agressor:

Mira soy nueva en esto de la programación, no entiendo a que te refieres con reconocerlos, te mando lo que tengo de código.


<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<body bgcolor="#FFFFFF" text="#000000">
<div id="wb_Table1" style="position:absolute; left:362px; top:201px; width:281px; height:123px; z-index:1" align="left">
<form name="form1" method="post" action="prue.jsp">
<table width="106%" border="1" cellpadding="0" cellspacing="1" id="Table1">
<tr>
<td height="36" colspan="2" align="left" valign="top" class="blackshade2"><div align="center">CONECTAR</div></td>
</tr>
<tr>
<td height="45" align="left" valign="top"><p><br>
Documento de usuario:</p>
</td>
<td height="45" ><input name="Docu_clie" type="text" id="Docu_clie"></td>
</tr>
<tr>
<td width="160" height="45" align="left" valign="top"><p align="left"><br>
Contrase&ntilde;a:</p<c:if test=""></c:if>>
</td>
<td width="129" height="45" >
<label>
<input name="cont_clie" type="password" class="main_table_border2" id="cont_clie">
<br>
</label> </td>
</tr>
<tr>
<td height="27" colspan="2" align="left" valign="top"><div align="center"><span>
<input class=button type=submit value="Entrar" name="OK">
</span></div></td>
</tr>
</table> </form>
</div>
</body>
</html>

<%@ page import="java.io.*, java.util.*, java.net.*, java.sql.*" %>

<%! int clave=0; %>

<%
Connection conn = null;
Statement stmt_consul=null, stmt_inser = null;
Object dato;
String strcon = "jdbc:mysql://localhost:3306/pruebas?user=prueba&password=prueba", q=null;

//conexion a la base de datos
try {
Class.forName("com.mysql.jdbc.Driver").newInstance ();
conn=DriverManager.getConnection(strcon);
stmt_inser = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITI VE,
ResultSet.CONCUR_UPDATABLE);
} catch(java.lang.ClassNotFoundException e){} catch(SQLException e) {};
ResultSet rs3= null;
String Docu_clie = request.getParameter("Docu_clie");
if(request.getParameter("OK") != null){

String cont_clie = request.getParameter("cont_clie");

try {
rs3 = stmt_inser.executeQuery("select * from usuarios where Docu_clie=Bere" + Docu_clie + "' and Cont_clie = 0406" + cont_clie + "'");
if(!rs3.next())
{
out.println("<h1>Usuario no registrado</h1><META HTTP-EQUIV=REFRESH CONTENT=1;URL=vlidacion.jsp>");
return;
}
do {

out.println("<b>Bienvenido "+rs3.getString("Nombre"));
out.println(rs3.getInt("Sueldo")+"</b>");
}
while(rs3.next());
}
catch (Exception ex)
{
ex.printStackTrace();
}

}
%>

Gracias de antemano.

Saludos.


Según yo esta la conexión y el formulario, pero le doy click a enviar siempre me manda al jsp de donde tengo el acceso a la base de datos, pero nunca me pone usuario no resgistrado.

Puedes ayudarme