Código:
package Tablas; import java.sql.*; public class TablaAlbaranes { public String Metodo(){ ResultSet rset = null; try{ DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver()); Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@IP:ORCL", "USUARIO", "CONTRASEÑA"); // driver@machineName:port:SID , userid, password Statement stmt = conn.createStatement(); rset = stmt.executeQuery("select ftr_supedido, ftr_numero, aux_ps_portes, AUX_PS_EXPEDICION, AUX_PS_AGENCIA, AUX_PS_FECHA||' '||TO_CHAR(AUX_PS_HORA,'HH24:MI:SS'), AUX_PS_BULTOS from sofinsa.cabecera, sofinsa.aux_partesalidas where ftr_tipodoc = 'A' and ftr_codcli = 70 and AUX_PS_ALBARAN = ftr_numero and ftr_fecha > sysdate - 31 order by aux_ps_fecha asc"); String tabla = "<table border="+"1"+" width="+"600px"+">"; tabla+="<tr bgcolor="+"#9DACBF"+"><td>Número</td><td>Pedido</td><td>Portes</td><td>Expedición</td><td>Agencia de Transportes</td><td>Fecha de Expedición</td><td>Bultos</td></tr>"; while (rset.next()){ tabla+="<tr>"; for (int i=1;i<=7;i++){ tabla+="<td>"; tabla+=rset.getString(i); tabla+="</td>"; } tabla+="</tr>"; } tabla+="</table>"; stmt.close(); return tabla; }catch (Exception e){ e.printStackTrace(); return e.getLocalizedMessage(); } } }
Código:
Me estoy leyendo cosas del useBean, pero no entiendo porqué falla, el error es este<body> <jsp:include page="Banner.html"/> <jsp:include page="Barra2.html"/> <br> <table width="100%"> <tr> <td width="30%"> <jsp:include page="TablaUsuarios.jsp"/> </td> <td valign="top"> <jsp:useBean id="Dat" class="Tablas.TablaAlbaranes" scope="request" /> <% out.println(Dat.Metodo()); %> </td> </tr> </table> </body> </html>
Código:
org.apache.jasper.JasperException: /Albaranes.jsp(22,4) at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148) at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1203) at org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1160) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343) at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393) at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399) at org.apache.jasper.compiler.Node$Root.accept(Node.java:489) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343) at org.apache.jasper.compiler.Generator.generate(Generator.java:3365) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:315) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267) at javax.servlet.http. HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Unknown Source)