Foros del Web » Programación para mayores de 30 ;) » Java »

error jsp

Estas en el tema de error jsp en el foro de Java en Foros del Web. - hola al desarrollar un jsp para paginacion pues tengo un error el cual no se el motivo y es el siguiente: es en el ...
  #1 (permalink)  
Antiguo 30/03/2011, 12:20
 
Fecha de Ingreso: abril-2010
Mensajes: 30
Antigüedad: 14 años
Puntos: 0
error jsp

- hola al desarrollar un jsp para paginacion pues tengo un error el cual no se el motivo y es el siguiente:
es en el inicio del jsp en el <%--
- mi conexion la tengo en un archivo java dentro de un paquete modelo:
modelo/ProductBean.java
Código HTML:
Error : Class, Interface or Enum expected
Código:
<%--     Document   : productList
    Created on : 29-mar-2011, 22:43:39
    Author     : HENRY
--%>

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page errorPage="JSP/Error.jsp?from=productList.jsp"%>

<html>
    <head>
         <title>Product List</title>
    </head>
    <body>
        <basefont size="12"  face="Arial">
        <jsp:useBean id="pBean" scope="session" class="modelo.ProductBean"/>
        <table align="center" width="600">
            <tr>
                <td width="20%"><b>ID Producto</b></td>
                <td width="30%"><b>Descripcion</b></td>
                <td width="30%"><b>Manufacturado</b></td>
                <td width="20%"><b>Precio</b></td>
            </tr>
            <%!
              int rowCount = 0;
              int startRow = 0;
            %>
            <%
              if(pBean.populate()){
              String start = (String)request.getParameter("start");
                    if(start != null){
                        startRow = new Integer(start).intValue();
                        pBean.setStarRow(startRow);
                    }
              while(rowCount < 10 && pBean.nextRow()>0){
                  rowCount++;
              }             
            %>
            <tr>
                <td width="20%"><jsp:getProperty name="pBean" property="idProd"/></td>
                <td width="20%"><jsp:getProperty name="pBean" property="descProd"/></td>
                <td width="20%"><jsp:getProperty name="pBean" property="manufProd"/></td>
                <td width="20%"><jsp:getProperty name="pBean" property="precioProd"/></td>
            </tr>
            <%
           }
         }
  %>
  <!-- visualizacion de los vinculos anterior y siguiente-->
         <tr>
             <td colspan="2" align="center">
                 <br><a href="?start=<%=(startRow > 9) ? startRow - 10 : 0%>">Back</a>
             </td>
             <td colspan="2" align="center">
                 <br><a href="?start=<%= pBean.getCurrentRow()%>">Next</a>
             </td>
         </tr>
       </table>
    </body>
</html>
  #2 (permalink)  
Antiguo 25/04/2011, 14:18
Avatar de valdo_kof  
Fecha de Ingreso: noviembre-2009
Ubicación: San Juan del Rio, Qro
Mensajes: 192
Antigüedad: 14 años, 5 meses
Puntos: 16
Respuesta: error jsp

mira al parecer te hace falta una linea yo uso el bean de esta forma

Código HTML:
Ver original
  1. <&#37;@ //a esta linea no le hagas caso sq siempre me pone unos numeros en vez del @ has caso desde lo siguiente:
  2.  
  3. <%@ page language="java" import="java.util.*, java.sql.*,modelo.ProductBean" pageEncoding="ISO-8859-1"%>
  4. <jsp:useBean id="pBean" class="modelo.ProductBean" scope="page">
  5.     <jsp:setProperty name="pBean" property="*"></jsp:setProperty>
  6. </jsp:useBean>

y ya nada mas mandas llamar tus metodos normal como lo haces

Código Java:
Ver original
  1. <%
  2.               if(pBean.populate()){
  3.               String start = (String)request.getParameter("start");
  4.                     if(start != null){
  5.                         startRow = new Integer(start).intValue();
  6.                         pBean.setStarRow(startRow);
  7.                     }
  8.               while(rowCount < 10 && pBean.nextRow()>0){
  9.                   rowCount++;
  10.               }            
  11.             %>

espero y te sirva

Etiquetas: jsp, jsp-servlets
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:21.