Problemas com o JSP

1 resposta
mhigo

Ola pessoal, estou desenvolvendo um projeto web pelo eclipse + tomcat, no eclipse tudo esta funcionando normalmente porém quando adicionei o sistema ao diretorio webapps do tomcat o sistema começou a apresentar um erro em toda tela jsp que possui algum import

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: 6 in the generated java file
Only a type can be imported. sistema.Fachada resolves to a package

An error occurred at line: 6 in the jsp file: /WebContent/login.jsp

Fachada cannot be resolved to a type

3: <%@ page import=sistema.Fachada%>

4:

5: <%

6: 	Fachada fachada = Fachada.obterInstancia();

Ja pesquisei mais nao consegui encontrar nada que solucionasse esse problema.

Se alguem conseguir me ajudar serei muito grato…

Obrigado

1 Resposta

H

Galera, desenvolvi um servlet que carrega uma combo acessando uma tabela em access, porém, aconteceu o seguinte problema:

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: 208 in the jsp file: /xxxxx/form_inclusao.jsp

The method isAberto() is undefined for the type PaisDestino

205: 	while (it.hasNext())

206: 	{

207: 		PaisDestino paisTemp = it.next();

208: 		if (paisTemp.isAberto())

209: 		{

210:

211: %>

O que pode ser??

No jsp, tento carregar da seguinte forma:

<%@ page language=java contentType=text/html; charset=iso-8859-1 pageEncoding="ISO-8859-1"

import=br.gov.xxx.xxx.xxxx.entidades.<em>"

%>

<%@ page import="java.util.</em>” %>

<%
Collection Pais = (Collection)request.getAttribute("paises");

%>
<%

java.util.Iterator <PaisDestino> it = Pais.iterator();
while (it.hasNext())
{
	PaisDestino paisTemp = it.next();
	if (paisTemp.isAberto())
	{

%>

<option value="<%=paisTemp.getCodigo()%>"><%=paisTemp.getNome()%></option>
<%

}

}

%>

Eis o servlet:
package br.xxx.xxx.xxx.xxxxx;

import java.io.IOException;
import java.util.Collection;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

/**

  • Servlet implementation class for Servlet: ActionListarPaises
<em>/

public class ActionListarPaises extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {

/</em> (non-Java-doc)

* @see javax.servlet.http.HttpServlet#HttpServlet()

*/
/**
 * 
 */
private static final long serialVersionUID = 1L;
private final String URL_DESTINO = "/xxxx/form_inclusao.jsp";
 
public ActionListarPaises() {
	super();
}   	

/* (non-Java-doc)
 * @see javax.servlet.http.HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
 */
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

	Collection<PaisDestino> listaPaises = xxxxxx.getListaPaises();
	
	request.setAttribute("paises", listaPaises);
	
	this.getServletContext().getRequestDispatcher(URL_DESTINO).forward(request, response);

}  	

/* (non-Java-doc)
 * @see javax.servlet.http.HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
 */
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	doGet(request,response);
}

}

a entidade:

public class PaisDestino {

private int codigo;
private String nome;
private String email;

public String getEmail() {
    return email;
}


public int getCodigo() {
	return codigo;
}
public void setCodigo(int codigoPaisDestino) {
	this.codigo = codigoPaisDestino;
}


public void setEmail(String email) {
    this.email = email;
}

public String getNome() {
    return nome;
}

public void setNome(String nome) {
    this.nome = nome;
}

}

Criado 17 de abril de 2009
Ultima resposta 14 de jun. de 2010
Respostas 1
Participantes 2