Mi problema es que cuando cambio de pestaña despues de listar mis articulos me sale un error 500 que no entiendo.
asi esta mi proyecto.
Código PHP:
Ver original
GetArticulos.java(servlet) SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); List<Articulos> articulos = (List<Articulos>) sqlMap.queryForList("selectAllArticulos"); request.getSession().setAttribute("articulos", articulos); } catch (SQLException ex) { } finally { RequestDispatcher dispatcher = request.getRequestDispatcher("listado.jsp"); dispatcher.forward(request, response); }
Código HTML:
Ver original
Mapeo IBATIS <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"> <sqlMap namespace="Articulos"> <typeAlias alias="Articulos" type="Articulos"/> <select id="selectAllArticulos" resultClass="Articulos"> SELECT co_articulo, de_articulo, umedida, if(estado=0,'NO ACTIVO','ACTIVO') estado FROM articulos where estado = '1' </select> <insert id="insertArticulo" parameterClass="Articulos"> INSERT INTO articulos (co_articulo, de_articulo, umedida, estado, usucrea, fecrea) VALUES (#co_articulo#, #de_articulo#, #umedida#, #estado#, #usucrea#, #fecrea#) </insert> <select id="getArticulo" parameterClass="string" resultClass="Articulos" > SELECT co_articulo, de_articulo, umedida, estado, usucrea, fecrea, usumodi, femodi FROM articulos where co_articulo = #valor# and estado = '1' </select> <update id="updateArticulo" parameterClass=" Articulos"> UPDATE articulos SET estado = #estado#, usumodi= #umodi#, femodi = #femodi# WHERE co_articulo = #co_articulo# </update> </sqlMap>
Código ASP:
Ver original
Error JSP - actualiza.jsp 500 Internal Server Error java.lang.ClassCastException: java.util.ArrayList at _actualiza._jspService(_actualiza.java:48) [/actualiza.jsp] at com.orionserver[Oracle Containers for J2EE 10g (10.1.3.5.0) ].http.OrionHttpJspPage.service(OrionHttpJspPage.java:59) at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:473) at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:594) at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:518) at javax.servlet.http.HttpServlet.service(HttpServlet.java:856) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:734) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:391) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:908) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:458) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.serveOneRequest(HttpRequestHandler.java:226) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:127) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].server.http.HttpRequestHandler.run(HttpRequestHandler.java:116) at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260) at oracle.oc4j.network.ServerSocketAcceptHandler.procClientSocket(ServerSocketAcceptHandler.java:234) at oracle.oc4j.network.ServerSocketAcceptHandler.access$700(ServerSocketAcceptHandler.java:29) at oracle.oc4j.network.ServerSocketAcceptHandler$AcceptHandlerHorse.run(ServerSocketAcceptHandler.java:879) at com.evermind[Oracle Containers for J2EE 10g (10.1.3.5.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303) at java.lang.Thread.run(Thread.java:595)
Código HTML:
Ver original
actualiza.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="pe.gob.reniec.sicoarticulos.model.Articulos" %> <jsp:useBean id="articulos" class="pe.gob.reniec.sicoarticulos.model.Articulos" scope="session"> <jsp:setProperty name="articulos" property="*"></jsp:setProperty> </jsp:useBean> <% if (articulos.equals(null)){ System.out.println(articulos); }%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link rel="stylesheet" href="css/style.css" type="text/css"> </head> <body> <br> <div class="navigator"> </div> <form method="post" name="form" id="form" action="actualiza.jsp"> <table> <tr> </td> </tr> <tr> </tr> <tr> </tr> </table> <br> <input type="button" value="Borrar Articulo" onclick="actArticulos();"> <br> </form> </body> </html>
Código XML:
Ver original
listado.jsp <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <%@page contentType="text/html" pageEncoding="UTF-8"%> <%@page import="java.util.*" %> <%@page import="Articulos" %> <html> <head> <title>Lista de Articulos</title> <link rel="stylesheet" href="css/style.css" type="text/css"> <script type="text/javascript" src="js/DriverManager.js"></script> </head> <body> <br> <div class="navigator"> <a href="index.jsp">Agregar articulos</a> <a id="currenttab" href="listado.jsp">Listar Articulos</a> <a href="actualiza.jsp">Borrar Articulos</a> </div> <br><br><br> <form method="get" id="form" action=""> <table id="articulos"> <tr> <th>CODIGO</th> <th>DESCRIPCION</th> <th>MEDIDA</th> <th>ESTADO</th> </tr> <% List<pe.gob.reniec.sicoarticulos.model.Articulos> list = (List<pe.gob.reniec.sicoarticulos.model.Articulos>)session.getAttribute("articulos"); for (Articulos a : list) { out.print("<tr class='unselected' id='row' onclick='clicked(this)' " + "onmouseout='unselect(this)' onmouseover='select(this)'>"); out.print("<td id='id'>" + a.getCo_articulo()+ "</td>"); out.print("<td>" + a.getDe_articulo() + "</td>"); out.print("<td>" + a.getUmedida() + "</td>"); out.print("<td>" + a.getEstado() + "</td>"); out.print("</tr>"); } %> </table> </form> </body> </html>
Código Javascript:
Ver original
El JS. function getArticulos() { form = window.document.getElementById("form"); form.action="GetAllArticulos"; form.submit(); } function actArticulos() { form = window.document.getElementById("form"); form.action="BorrarArticulo"; form.submit(); } function insertArticulo() { form = window.document.getElementById("form"); form.action="InsertArticulo"; form.submit(); } function buscarArticulo() { form = window.document.getElementById("form"); form.action="BuscarArticulo"; form.submit(); }
de antemano Muchas Gracias.