<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<head>
<%
response.setHeader("Cache-Control","no-store"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader("Expires", 0); // prevents caching at the proxy server
if(session.getAttribute("altaCliente")==null)
{
response.sendRedirect("PanelAdministracionUsuario.jsp");
}
%>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin título</title>
<style type="text/css">
<!--
.Estilo1 { font-size: 24px;
font-weight: bold;
}
body {
background-image: url(./images/wave3header.jpg);
background-repeat: no-repeat;
}
.Estilo9 {color: #FFFFFF}
.Estilo10 {color: #FFFFFF; font-weight: bold; }
.Estilo11 {
color: #FFFFFF;
font-size: 24px;
font-weight: bold;
font-style: italic;
}
-->
</style>
</head>
<body>
<p> </p>
<p> </p>
<p> </p>
<table width="704" border="1" align="center">
<tr>
<td width="694" height="519" background="./images/fondoUser.jpg"><div align="center">
<p class="Estilo1"> </p>
<p class="Estilo11">ALTA DE UN CLIENTE WEB </p>
<br />
<br />
<span class="Estilo9"><br />
</span>
<form action="AltaClienteWeb.jsp" method="post">
<p class="Estilo10">Numero de documento :
<input type="text" name="nroDocumento" />
<input type=submit name="btnValidarNroDocumento" value="..." />
</p>
<p class="Estilo10">Nombre:
<input type="text" name="nombreCliente" disabled="disabled" />
</p>
<p class="Estilo10">Apellido:
<input type="text" name="apellidoCliente" disabled="disabled" />
<br />
<br />
Contraseña:
<input type="password" name="password" disabled="disabled" />
<br />
<br />
Confirma contraseña:
<input type="password2" name="password2" disabled="disabled" />
<br />
<br />
<br />
<br />
<input name="btnEnviar" type="submit" value="Enviar" disabled="disabled"/>
<input name="reset" type="reset" value="Borrar" />
</p>
<p class="Estilo10"> </p>
</form>
</div></td>
</tr>
</table>
<jsp:useBean id="boCliente" scope="page" class="Negocio.BOCliente" ></jsp:useBean>
<jsp:useBean id="clienteAux" scope="page" class="Entidades.Cliente" ></jsp:useBean>
<%
//Codigo en JAVA...
Boolean test=false;
if (request.getParameter("btnValidarNroDocumento")!=null)
{
int nroDoc = Integer.parseInt(request.getParameter("nroDocumento"));
clienteAux = boCliente.verificarCliente(nroDoc);
if (clienteAux!=null)
{
session.setAttribute("sessionNDoc", clienteAux.getNroDoc());
session.setAttribute("sessionNombre", clienteAux.getNombre());
session.setAttribute("sessionApellido", clienteAux.getApellido());
test=true;
//El cliente existe...
}
}
if (request.getParameter("btnEnviar") != null)
{
String password=request.getParameter("password");
int nroDoc=(Integer)session.getAttribute("sessionNDoc");
if (boCliente.addClienteWeb(password, nroDoc) > 0)
{
test=false;
session.setAttribute("sessionpass", password);
RequestDispatcher redireccion = request.getRequestDispatcher("ConfirmaClienteWeb.jsp");
redireccion.forward(request, response);
}
}
%>
<%
if (test)
{
%>
<script type="text/javascript">
var num=false
document.forms[0].password.disabled = num;
document.forms[0].password2.disabled = num;
document.forms[0].nroDocumento.disabled = !num;
document.forms[0].btnValidarNroDocumento.disabled = !num;
document.forms[0].btnEnviar.disabled = num;
js_nro_doc = "<%=session.getAttribute("sessionNDoc")%>"
document.forms[0].elements["nroDocumento"].value = js_nro_doc;
js_nombre = "<%=session.getAttribute("sessionNombre")%>";
document.forms[0].elements["nombreCliente"].value = js_nombre;
js_apellido = "<%=request.getSession().getAttribute("sessionApellido")%>";
document.forms[0].elements["apellidoCliente"].value = js_apellido;
</script>
<%
}
%>