Miren, cuando trato de depurar, me muestra una pantalla anormal :/ !
Este es mi codigo : Listado_Producto.jsp
Código:
por otro lado, tambien me aparece un error en el netbeans, aunque no sé porque se produsca.<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %> <%@page import="DATA.*"%> <%@page import="BEANS.*"%> <%@page import="java.util.ArrayList"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <script language="javascript"> //Funcion que deshabilita todos las cajas de texto function deshabilitar(){ //capturamos la cantidad de checkBox var p=document.form1.chk.length; for(x=0;x<p;x++){ document.form1.txtcantidad[x].disabled=true; document.form1.txtcantidad[x].value=""; } } //Funcion que habilita la caja de texto seleccionado function Habilitar(pos){ if(document.form1.chk[pos].checked==true){ document.form1.txtcantidad[pos].disabled=false; document.form1.txtcantidad[pos].value="1"; document.form1.txtcantidad[pos].focus(); }else{ document.form1.txtcantidad[pos].disabled=true; document.form1.txtcantidad[pos].value=""; } } //Funcion que nos manda a la pagina Carrito.jsp function ir_Pagina(){ window.location="Carrito.jsp"; } </script> <body onload="deshabilitar()"> <form id="form1" name="form1" method="post" action=""> <table width="355" border="0" align="center"> <tr> <td align="center">Listado de Productos</td> </tr> <tr> <% ArrayList<BeansProducto> lista1=new ArrayList(); DataProducto objdata=new DataProducto(); lista1=objdata.lista_Producto(); int contador=0,a=0; for(BeansProducto p:lista1){ %> <td><table width="335" height="111" border="3"> <tr> <td width="100" rowspan="4"><img src="Imagenes/<%=p.getCod()%>.jpg" alt="" width="94" height="113" /></td> <td width="92">Descripcion</td> <td width="117"><%=p.getNom()%></td> </tr> <tr> <td>Precio</td> <td>S/. <%=p.getPre()%></td> </tr> <tr> <td height="26"><input type="checkbox" name="chk" onclick="Habilitar(<%=a%>)" value="<%=p.getCod()%>,<%=p.getNom()%>,<%=p.getPre()%>"/> <label for="chk">Cantidad</label></td> <td><label for="txtcantidad"></label> <input name="txtcantidad" type="text" id="txtcantidad" size="10" maxlength="3" /></td> </tr> </table></td> <% contador+=1; a++; if(contador==3){ out.print("<tr>"); contador=0; } } %> </tr> </table> <table width="200" border="0" align="center"> <tr> <td align="center"><input type="submit" name="btncomprar" value="Comprar" /></td> <td align="center"><input type="button" name="btnver" value="Ver Carrito" onclick="ir_Pagina()"/></td> </tr> </table> <p> </p> </form> <% //Vamos a PReguntar por los CheckBox Seleccionados if(request.getParameter("chk")!=null){ //capturando los valores del CheckBox (codigo,nombre,precio) String valores[]=request.getParameterValues("chk"); //capturando los valores de los TextBox String cantidad[]=request.getParameterValues("txtcantidad"); for(int x=0;x<valores.length;x++){ Canasta c=new Canasta(); String datos[]=valores[x].split(","); c.setCod(datos[0]); c.setNom(datos[1]); c.setPre(Double.parseDouble(datos[2])); c.setCant(Integer.parseInt(cantidad[x])); c.setTotal(c.getPre()*c.getCant()); //Vamos agregar al ArrayList c.Agregar_carrito(c); } Canasta v=new Canasta(); out.print("<br><center>Cantidad de Productos "+ v.listado_carrito().size()+"</center> "); } %> </body> </html>
en la pestaña : "GlassFish Server 3.1.2"
Código:
Necesito una ayudita aqui, porfavor :/ Launching GlassFish on Felix platform INFO: Running GlassFish Version: GlassFish Server Open Source Edition 3.1.2.2 (build 5) INFO: Registered org.glassfish.ha.store.adapter.cache.ShoalBackingStoreProxy for persistence-type = replicated in BackingStoreFactoryRegistry INFO: Grizzly Framework 1.9.50 started in: 144ms - bound to [0.0.0.0:8080] INFO: Grizzly Framework 1.9.50 started in: 123ms - bound to [0.0.0.0:4848] INFO: Grizzly Framework 1.9.50 started in: 134ms - bound to [0.0.0.0:8181] INFO: Grizzly Framework 1.9.50 started in: 116ms - bound to [0.0.0.0:3700] INFO: Grizzly Framework 1.9.50 started in: 107ms - bound to [0.0.0.0:7676] INFO: SEC1002: Security Manager is OFF. INFO: SEC1010: Entering Security Startup Service INFO: SEC1143: Loading policy provider com.sun.enterprise.security.provider.PolicyWrapper. INFO: SEC1115: Realm [admin-realm] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created. INFO: SEC1115: Realm [file] of classtype [com.sun.enterprise.security.auth.realm.file.FileRealm] successfully created. INFO: SEC1115: Realm [certificate] of classtype [com.sun.enterprise.security.auth.realm.certificate.CertificateRealm] successfully created. INFO: SEC1011: Security Service(s) Started Successfully INFO: WEB0169: Created HTTP listener [http-listener-1] on host/port [0.0.0.0:8080] INFO: WEB0169: Created HTTP listener [http-listener-2] on host/port [0.0.0.0:8181] INFO: WEB0169: Created HTTP listener [admin-listener] on host/port [0.0.0.0:4848] INFO: WEB0171: Created virtual server [server] INFO: WEB0171: Created virtual server [__asadmin] INFO: WEB0172: Virtual server [server] loaded default web module [] INFO: WEB0671: Loading application [Carrito_Compra] at [/Carrito_Compra] INFO: CORE10010: Loading application Carrito_Compra done in 2.428 ms INFO: GlassFish Server Open Source Edition 3.1.2.2 (5) tiempo de inicio: Felix (2.287ms), servicios de inicio(3.311ms), total(5.598ms) INFO: HV000001: Hibernate Validator 4.3.0.Final INFO: JMX005: JMXStartupService had Started JMXConnector on JMXService URL service:jmx:rmi://LeoTheFox-PC:8686/jndi/rmi://LeoTheFox-PC:8686/jmxrmi INFO: WEB0169: Created HTTP listener [http-listener-1] on host/port [0.0.0.0:8080] INFO: Grizzly Framework 1.9.50 started in: 32ms - bound to [0.0.0.0:8080] INFO: WEB0169: Created HTTP listener [http-listener-2] on host/port [0.0.0.0:8181] INFO: Grizzly Framework 1.9.50 started in: 45ms - bound to [0.0.0.0:8181] INFO: WEB0671: Loading application [Carrito_Compra] at [/Carrito_Compra] INFO: Carrito_Compra se ha desplegado correctamente en 575 milisegundos. INFO: La Conexion se Dio Correctamente WARNING: StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception java.awt.HeadlessException at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:207) at java.awt.Window.<init>(Window.java:535) at java.awt.Frame.<init>(Frame.java:420) at java.awt.Frame.<init>(Frame.java:385) at javax.swing.SwingUtilities$SharedOwnerFrame.<init>(SwingUtilities.java:1759) at