Exception report - useBean

0 respostas
passos

Prezados, estou tentando executar um exemplo bem simples de useBean porem estou recebendo o erro: org.apache.jasper.JasperException: Unable to compile class for JSP

Dentro do webapps criei o diretorio teste e dentro do mesmo tenho 1 JSP dentro de teste criei WEB-INF e coloquei o web.xml e dentro do mesmo criei um diretorio classes e joguei minha classes la dentro

web.xml
<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
    PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
  <display-name>Teste</display-name>
  <description>
     Teste
  </description>
</web-app>
JSP

<jsp:useBean id="cli" scope="session" class="Cliente"/>
<table>
  <tr>
    <td><jsp:getProperty name="cli" property="id" /></td>
    <td><jsp:getProperty name="cli" property="nome" /></td>
  </tr>
</table>
class Cliente (Bean)

public class Cliente {
	
	private int id = 1;
	private String nome = "Daniel Passos";
	
	public Cliente() {
		super();
	}
	
	/**
	 * @return
	 */
	public int getId() {
		return id;
	}

	/**
	 * @return
	 */
	public String getNome() {
		return nome;
	}

	/**
	 * @param i
	 */
	public void setId(int i) {
		id = i;
	}

	/**
	 * @param string
	 */
	public void setNome(String string) {
		nome = string;
	}

}

Erro:

HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 1 in the jsp file: /teste.jsp

Generated servlet error:
[javac] Compiling 1 source file

C:Arquivos de programasjakarta-tomcat-5.0.18workCatalinalocalhost esteorgapachejsp este_jsp.java:40: cannot resolve symbol
symbol : class Cliente
location: class org.apache.jsp.teste_jsp
Cliente cli = null;
^

An error occurred at line: 1 in the jsp file: /teste.jsp

Generated servlet error:
C:Arquivos de programasjakarta-tomcat-5.0.18workCatalinalocalhost esteorgapachejsp este_jsp.java:42: cannot resolve symbol
symbol : class Cliente
location: class org.apache.jsp.teste_jsp
cli = (Cliente) pageContext.getAttribute("cli", PageContext.SESSION_SCOPE);
^

An error occurred at line: 1 in the jsp file: /teste.jsp

Generated servlet error:
C:Arquivos de programasjakarta-tomcat-5.0.18workCatalinalocalhost esteorgapachejsp este_jsp.java:44: cannot resolve symbol
symbol : class Cliente
location: class org.apache.jsp.teste_jsp
cli = new Cliente();
^

An error occurred at line: 4 in the jsp file: /teste.jsp

Generated servlet error:
C:Arquivos de programasjakarta-tomcat-5.0.18workCatalinalocalhost esteorgapachejsp este_jsp.java:52: cannot resolve symbol
symbol : class Cliente
location: class org.apache.jsp.teste_jsp
out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((Cliente)pageContext.findAttribute("cli")).getId())));
^

An error occurred at line: 5 in the jsp file: /teste.jsp

Generated servlet error:
C:Arquivos de programasjakarta-tomcat-5.0.18workCatalinalocalhost esteorgapachejsp este_jsp.java:55: cannot resolve symbol
symbol : class Cliente
location: class org.apache.jsp.teste_jsp
out.write(org.apache.jasper.runtime.JspRuntimeLibrary.toString((((Cliente)pageContext.findAttribute("cli")).getNome())));
^
5 errors

org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:127)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:351)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:458)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:552)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:291)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

note The full stack trace of the root cause is available in the Tomcat logs.

--------------------------------------------------------------------------------

Apache Tomcat/5.0.18[/code]

Criado 5 de maio de 2004
Respostas 0
Participantes 1