Académique Documents
Professionnel Documents
Culture Documents
Tcnico
Proyecto
Contenido
INSTALAR APACHE TOMCAT ........................................................................................... 3
PASO 1 DESCARGAR PROGRAMA ........................................................................... 3
PASO 2 SELECCIONAR PROGRAMA .......................................................................... 3
PASO 3 INSTALAR PROGRAMA ................................................................................. 4
PASO 4 ABRIR EL NAVEGADOR ............................................................................... 4
INSTALAR XAMPP .......................................................................................................... 5
PASO 1 DESCARGAR XAMPP .................................................................................. 5
PASO 2 EJECUTAR E INSTALAR PROGRAMA ............................................................ 5
PASO 3 ACEPTAR LA CONFIGUARACION PREDETERMINADA ........................................ 6
PASO 4 EJECUTAR PROGRAMA .............................................................................. 6
PASO 4 ABRIMOS EL CONTROL DE XAMPP .............................................................. 7
PASO 6 INICIAR LOS COMPONENTES DE APACHE Y MYSQL ....................................... 7
TAMBIN PUEDES INICIAR LOS OTROS COMPONENTES SI LOS VAS A USAR. .................... 7
INSTALAR NETBEANS ..................................................................................................... 8
PASO 1 DESCARGAR PROGRAMA .......................................................................... 8
PASO 2 EJECUTAR E INSTALAR PROGRAMA ............................................................. 9
PASO 3 EJECUTAR PROGRAMA .............................................................................. 9
CREAR PROYECTO JAVA W EB ...................................................................................... 10
PASO 1 CREAR NUEVO PROYECTO ........................................................................ 10
PASO 2 AGREGAMOS LIBRERA ............................................................................ 12
CREAR BASE DE DATOS ............................................................................................... 13
CREAR JSP CONEXIN ................................................................................................. 14
CDIGO CONEXIN .............................................................................................. 15
CREAR JSP CONSULTA ................................................................................................ 16
CDIGO .............................................................................................................. 17
CREAR JSP INGRESO_PRODUCTO ................................................................................. 19
CODIGO .............................................................................................................. 20
PROYECTO ................................................................................................................. 21
PAGINA PRINCIPAL .............................................................................................. 21
PGINA DE SERVICIO ........................................................................................... 21
Instalar Xampp
XAMPP para Windows ofrece una fcil instalacin de los frameworks ApacheMySQL,
PHP, PERL, PEAR. XAMPP te ahorra tiempo y esfuerzo, y proporciona soporte de
frameworks como Drupal, Joomla, Moodle, o Wikimedia en cualquier computadora con
Windows.
Paso 1 Descargar Xampp
Descargamos Xampp de la web https://www.apachefriends.org/es/index.html
Instalar Netbeans
Paso 1 Descargar Programa
Descargamos e instalamos Java JDK
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads1880260.html?ssSourceSiteId=otnes
Nos interesan las sealadas en un cuadro verde (dependiendo de si el sistema
operativo es de 32 o 64 bits)
1
0
1
1
1
2
1
3
1
4
1
5
Cdigo Conexin
<%@page contentType="text/html" pageEncoding="UTF-8"
import="java.sql.Connection"
import="java.sql.DriverManager"
import="java.sql.ResultSet"
import="java.sql.Statement"
import="java.sql.SQLException"
%>
<%
Connection conex=null;
Statement sql=null;
1
6
try {
Class.forName ("com.mysql.jdbc.Driver");
conex=(Connection)DriverManager.getConnection("jdbc:mysql://127.0.0.1/dbaltecsist
em","root","");
sql=conex.createStatement();
//out.print("CONEXION EXITOSA");
}catch(Exception e){
%>
Seleccionamos New Jsp, escribimos el nombre de nuestro jsp en este caso es consulta
y presionamos finalizar
1
7
Cdigo
<%@page contentType="text/html" pageEncoding="UTF-8"
import="java.sql.Connection"
import="java.sql.DriverManager"
import="java.sql.ResultSet"
import="java.sql.Statement"
import="java.sql.SQLException"
%>
1
8
<%
try
{
// Conexion con bd
Class.forName("com.mysql.jdbc.Driver");
Connection conex =
DriverManager.getConnection("jdbc:mysql://127.0.0.1/dbaltecsistem","root","");
if (!conex.isClosed())
{
// La consulta
Statement st = conex.createStatement();
ResultSet rs = st.executeQuery("select * from t_producto" );
out.println("<table
border=\"1\"><tr><td>Id</td><td>cod_prod</td><td>Nombre</td><td>Descripcion</t
d><td>Precio</td></tr>");
while (rs.next())
{
out.println("<tr>");
out.println("<td>"+rs.getObject("id_din")+"</td></td>");
out.println("<td>"+rs.getObject("cod_prod")+"</td></td>");
out.println("<td>"+rs.getObject("nom_prod")+"</td></td>");
out.println("<td>"+rs.getObject("descrip_prod")+"</td></td>");
out.println("<td>"+rs.getObject("precio_prod")+"</td></td>");
out.println("</tr>");
out.println("</h1>");
}
out.println("</table>");
conex.close();
1
9
}
else
// Error en la conexion
out.println("fallo");
}
catch (Exception e)
{
// Error en algun momento.
out.println("Excepcion "+e);
e.printStackTrace();
}
%>
<br/><br/><br/><br/>
</body>
</html>
2
0
Codigo
<h1>Insertar Datos</h1>
<%
String cod_prod=request.getParameter("txtcod_prod");
String nom_prod=request.getParameter("txtnom_prod");
String descrip_prod=request.getParameter("txtdescrip_prod");
String precio_prod=request.getParameter("txtprecio_prod");
( cod_prod!=null && nom_prod!=null && descrip_prod!=null &&
precio_prod!=null){
2
1
if
Proyecto
2
2
Pagina Principal
Pgina de Servicio
2
3
Pgina de Solicitud
2
4
Base de Datos
2
5
2
6