Escolar Documentos
Profissional Documentos
Cultura Documentos
<%
try {
ResultSet rs = link.createStatement().executeQuery(ConSQL);
while (rs.next()){
String Documento = rs.getString(1);
%>
<tr>
<td><A HREF ="frmver.jsp?Documento=<%
out.print(Documento); %>">Ver</a> </td>
<td align="center" >
<A HREF ="frmmodificarestudiante.jsp?
Documento='78742034'">
<img src="img/editar.png" width="15" height="15"
alt="Editar Registro"/>
</a>
</td>
<td>
<form action="frmeliminar.jsp">
<input type="submit" value="Eliminar" onclick="return
confirmSubmit();" />
<input type="hidden" name="TxtDocumento" value="<%
out.print(Documento); %>" />
</form>
</td>
<td><%
<td><%
<td><%
<td><%
<td><%
</tr>
<%
}
rs.close();
}
catch(SQLException ex){
out.print("Error: " + ex.getMessage().toString() );
}
%>
</tbody>
</table>
</body>
</html>
frmnuevo.jsp y su cdigo
<%@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>
<h1>Nuevo Estudiante</h1>
<form action="frmgrabarnuevo.jsp">
<table border="1">
<thead>
<tr>
<th colspan="2"> Ingrese datos nuevo estudiante</th>
</tr>
</thead>
<tbody>
<tr>
<td>Documento</td>
<td><input type="text" name="TxtDocumento" value=""
/></td>
</tr>
<tr>
<td>Nombres</td>
<td><input type="text" name="TxtNombres" value=""
/></td>
</tr>
<tr>
<td>Apellidos</td>
<td><input type="text" name="TxtApellidos" value=""
/></td>
</tr>
<tr>
<td>Direccin</td>
<td><input type="text" name="TxtDireccion" value=""
/></td>
</tr>
<tr>
<td>Correo</td>
<td><input type="text" name="TxtCorreo" value="" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Grabar" />
</td>
</tr>
</tbody>
</table>
</form>
</body>
</html>
frmGrabarNuevo.jsp y su cdigo.
<%@ page contentType="text/html; charset=iso-8859-1" language="java"
import="java.sql.*" errorPage="" %>
<%@ page import="datos.Conex"%>
<%
datos.Conex Ls = new datos.Conex();
Connection link = Ls.Conectarse();
String Documento = request.getParameter("TxtDocumento");
String Nombres = request.getParameter("TxtNombres");
String Apellidos = request.getParameter("TxtApellidos");
String Direccion = request.getParameter("TxtDireccion");
String Correo = request.getParameter("TxtCorreo");
String ConSQL = "INSERT INTO tbestudiantes values('" + Documento +
"','" + Nombres + "','" + Apellidos + "','" + Direccion + "','" +
Correo + "')";
link.createStatement().execute(ConSQL);
out.print("<script language=Javascript>alert('Estudiante
Ingresado');</script>");
out.print("<script
language=Javascript>location.href=\"frmEstudiantes.jsp\";</script>");
%>
frmVer.jsp y su cdigo.
<%@ page contentType="text/html; charset=iso-8859-1" language="java"
import="java.sql.*" errorPage="" %>
<%@ page import="datos.Conex"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Nuevo Estudiante</h1>
<%
datos.Conex Ls = new datos.Conex();
Connection link = Ls.Conectarse();
String ConSQL = "Select * FROM tbestudiantes "
+ " WHERE DocumentoEstudiante='" +
request.getParameter("Documento") + "'";
try{
ResultSet rs = link.createStatement().executeQuery(ConSQL);
if (rs.next()) {
%>
<form action="frmEstudiantes.jsp">
<table border="1">
<thead>
<tr>
<th colspan="2"> Datos del estudiante</th>
</tr>
</thead>
<tbody>
<tr>
<td>Documento</td>
<td><% out.print(rs.getString(1)); %></td>
</tr>
<tr>
<td>Nombres</td>
<td><% out.print(rs.getString(2)); %></td>
</tr>
<tr>
<td>Apellidos</td>
<td><% out.print(rs.getString(3)); %></td>
</tr>
<tr>
<td>Direccin</td>
<td><% out.print(rs.getString(4)); %></td>
</tr>
<tr>
<td>Correo</td>
<td><% out.print(rs.getString(5)); %></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Volver" />
</td>
</tr>
</tbody>
</table>
</form>
<%
}
}
catch(SQLException ex){
out.print("Error: " + ex.getMessage().toString() );
}
%>
</body>
</html>
frmEliminar.jsp y su cdigo.
<%@ page contentType="text/html; charset=iso-8859-1" language="java"
import="java.sql.*" errorPage="" %>
<%@ page import="datos.Conex"%>
<%
datos.Conex Ls = new datos.Conex();
Connection link = Ls.Conectarse();
String Documento = request.getParameter("TxtDocumento");
String ConSQL = "DELETE FROM tbestudiantes where
DocumentoEstudiante='" +
Documento + "'";
link.createStatement().execute(ConSQL);
out.print("<script language=Javascript>alert('Estudiante
Eliminado');</script>");
out.print("<script
language=Javascript>location.href=\"frmEstudiantes.jsp\";</script>");
%>
frmmodificarestudiante.jsp y su cdigo.
<%@ page contentType="text/html; charset=iso-8859-1" language="java"
import="java.sql.*" errorPage="" %>
<%@ page import="datos.Conex"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Modificar Estudiante</h1>
<%
datos.Conex Ls = new datos.Conex();
Connection link = Ls.Conectarse();
String ConSQL = "Select * FROM tbestudiantes "
+ " WHERE DocumentoEstudiante='" +
request.getParameter("Documento") + "'";
try{
ResultSet rs = link.createStatement().executeQuery(ConSQL);
if (rs.next()) {
String Documento = rs.getString(1);
%>
<form action="frmgrabarmodificacion.jsp">
<table border="1">
<thead>
<tr>
<th colspan="2"> Ingrese datos nuevo estudiante</th>
</tr>
</thead>
<tbody>
<tr>
<td>Documento</td>
<td>
<% out.print(Documento); %>
<input type="hidden" name="TxtDocumento" value=" <%
out.print(Documento); %>" />
</td>
</tr>
<tr>
<td>Nombres</td>
<td><input type="text" name="TxtNombres" value="<%
out.print(rs.getString(2)); %>" /></td>
</tr>
<tr>
<td>Apellidos</td>
<td><input type="text" name="TxtApellidos" value="<%
out.print(rs.getString(3)); %>" /></td>
</tr>
<tr>
<td>Direccin</td>
<td><input type="text" name="TxtDireccion" value="<%
out.print(rs.getString(4)); %>" /></td>
</tr>
<tr>
<td>Correo</td>
<td><input type="text" name="TxtCorreo" value="<%
out.print(rs.getString(5)); %>" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Grabar" />
</td>
</tr>
</tbody>
</table>
</form>
<%
}
}
catch(SQLException ex){
out.print("Error: " + ex.getMessage().toString() );
}
%>
</body>
</html>
frmgrabarmodificacion.jsp y su cdigo.
<%@ page contentType="text/html; charset=iso-8859-1" language="java"
import="java.sql.*" errorPage="" %>
<%@ page import="datos.Conex"%>
<%
datos.Conex Ls = new datos.Conex();
Connection link = Ls.Conectarse();
String Documento = request.getParameter("TxtDocumento");
String Nombres = request.getParameter("TxtNombres");
String Apellidos = request.getParameter("TxtApellidos");
String Direccion = request.getParameter("TxtDireccion");
String Correo = request.getParameter("TxtCorreo");
String ConSQL = "UPDATE tbestudiantes SET
Nombres='"+Nombres+"',Apellidos='"+Apellidos+"',Direccion='"+Direccion+"'
,Correo='"+Correo+"' WHERE DocumentoEstudiante="+ Documento;
link.createStatement().execute(ConSQL);
out.print("<script language=Javascript>alert('Estudiante
Actualizado');</script>");
out.print("<script
language=Javascript>location.href=\"frmEstudiantes.jsp\";</script>");
%>
estilo.css y su cdigo
BODY {
font-family: Verdana, sans-serif, Arial;
font-weight: bold;
font-size: .9em;
color:#000000;
background-color:#ffffff;
background-repeat:no-repeat;
background-attachment:fixed;
margin: 0px 0px;
}
a.sinsubraya
{
text-decoration:none;
color:#ff0000;
font-weight: bold;
}
a.sinsubraya:hover
{
color:#000000;
text-decoration:underline;
font-weight: bold;
}
TABLE
{
width:90%;
background-color: #ffffff;
border: 1px #000000 solid;
border-collapse: collapse;
border-spacing: 0px;
}
TABLE.ficha
{
width:60%;
background-color: #ffffff;
border: 1px #000000 solid;
border-collapse: collapse;
border-spacing: 0px;
}
TABLE.mensaje
{
width:460px;
background-color: #ffffff;
border: 0px;
}
TABLE.mensaje2
{
width:90%;
background-color: #ffffff;
border: 1px #ffffff solid;
border-collapse: collapse;
border-spacing: 0px;
}
TD
{
border-bottom: 1px #0C9816 dotted;
text-align: left;
font-family: Verdana, sans-serif, Arial;
font-weight: bold;
font-size: .9em;
color: #000000;
background-color: #ffffff;
}
TD.derecha
{
border-bottom: 1px #0C9816 dotted;
text-align: right;
font-family: Verdana, sans-serif, Arial;
font-weight: bold;
font-size: .9em;
color: #000000;
background-color: #ffffff;
}
TD.primeralinea
{
border-bottom: 1px #0C9816 dotted;
border: 1px dotted #0c9816;
text-align: center;
font-family: Verdana, sans-serif, Arial;
font-weight: bold;
font-size: .9em;
color: #ffffff;
background-color: #76B77A;
}
TD.primeralineaizquierda
{
border-bottom: 1px #0C9816 dotted;
border: 1px dotted #0c9816;
text-align: left;
font-family: Verdana, sans-serif, Arial;
font-weight: bold;
font-size: .9em;
color: #ffffff;
background-color: #76B77A;
}
TD.segundalinea
{
border-bottom: 1px #0C9816 dotted;
border-right: 1px #0C9816 dotted;
border-left: 1px #0C9816 dotted;
text-align: center;
font-family: Verdana, sans-serif, Arial;
font-weight: normal;
font-size: .6em;
color: #404040;
background-color: #ffffff;
}
TD.segundalineaizquierda
{
border-bottom: 1px #0C9816 dotted;
border-right: 1px #0C9816 dotted;
FONT-SIZE: 7pt;
}
La tabla sobre la cual se ha trabajado.
Ok, all estn las 4 funciones bsicas que se pueden llevar a cabo sobre una
base de datos. Esto debe estar funcionando perfectamente para el prximo
jueves 22 de octubre, individualmente.