[Previo por Fecha] [Siguiente por Fecha] [Previo por Hilo] [Siguiente por Hilo]

[Hilos de Discusión] [Fecha] [Tema] [Autor]

Re: [Ayuda] Pregunta de Apache Tomcat y JavaBeans



Sin pensarlo ni investigar mucho: Prueba tu bean SIN paquete.

Mensaje citado por Alejandro Martínez <almarag en tutopia com>:

> Saludos $world:
> 
> Ojalá alguien de por aquí maneje Tomcat para que me oriente un poco:
> 
> Estoy empezando a hacer algunos pininos con Tomcat, sin embargo, estoy
> teniendo problemas con un maldito JavaBean que no se deja. El Bean es
> espantosamente simple:
> 
> package tablabean;
> 
> public class tablabean{
> 
> 	public static String drawtable(){
> 
> 		String tabla = "<table><tr><th>Col 1</th><th>Col 2</th></tr>";
> 		tabla += "<tr><td>Fila 1/1</td><td>Fila 1/2</td></tr>";
> 		tabla += "</table>";
> 		return tabla;
> 
> 	}
> 
> }
> 
> Luego, la página jsp desde donde lo invoco es:
> 
> <?xml version="1.0" encoding="iso-8859-1"?>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
> <%@ page contentType="text/html; charset=iso-8859-1" language="java"
> import="java.sql.*" errorPage="" %>
> <html xmlns="http://www.w3.org/1999/xhtml";>
> <head>
> <jsp:useBean class="tablabean.tablabean" id="bean0" scope="page" />
> <title>Prueba de JavaBean</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
> </head>
> 
> <body>
> 
> <%= bean0.drawTable(); %>
> 
> </body>
> </html>
> 
> El bean compila perfecto, y lo copio a mi directorio
> /WEB-INF/classes/tablabean/tablabean.class
> 
> Sin embargo, el maldito Tomcat parece no pelar el directorio classes, ya que
> me manda el típico error 500, escupiendo:
> 
> An error occurred at line: 6 in the jsp file: /tablabean.jsp
> 
> Generated servlet error:
>     [javac] Compiling 1 source file
> 
> C:\Archivos de programa\Apache Group\Tomcat
> 4.1\work\Standalone\localhost\_\tablabean_jsp.java:8: package tablabean does
> not exist
> import tablabean.*;
> ^
> C:\Archivos de programa\Apache Group\Tomcat
> 4.1\work\Standalone\localhost\_\tablabean_jsp.java:49: package tablabean
> does not exist
>       tablabean.tablabean bean0 = null;
>                ^
> 
> An error occurred at line: 6 in the jsp file: /tablabean.jsp
> 
> Generated servlet error:
> C:\Archivos de programa\Apache Group\Tomcat
> 4.1\work\Standalone\localhost\_\tablabean_jsp.java:51: package tablabean
> does not exist
>         bean0 = (tablabean.tablabean) pageContext.getAttribute("bean0",
> PageContext.PAGE_SCOPE);
>                           ^
> An error occurred at line: 6 in the jsp file: /tablabean.jsp
> 
> Generated servlet error:
> C:\Archivos de programa\Apache Group\Tomcat
> 4.1\work\Standalone\localhost\_\tablabean_jsp.java:54: package tablabean
> does not exist
>             bean0 = (tablabean.tablabean)
> java.beans.Beans.instantiate(this.getClass().getClassLoader(),
> "tablabean.tablabean");
>                               ^
> 4 errors
> 
> 
> Ya reinicié el server 'n' veces, revisé que los directorios estén
> correctamente puestos y escritos, y en apariencia todo es correcto, pero
> para Tomcat no existe el paquete. ¿Qué estoy haciendo mal?, ¿alguna pista?.
> Llevo googleando un buen rato y no he encontrado respuesta, ojalá alguien me
> pueda dar una orientada. Gracias y saludos.
> 
> almarag.
> 
> 
> 
>  
> _______________________________________________
> Ayuda mailing list
> Ayuda en linux org mx
> Para salir de la lista:
> http://mail.linux.org.mx/cgi-bin/mailman/listinfo/ayuda/
> 




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





[Hilos de Discusión] [Fecha] [Tema] [Autor]