Exception creating bean of class

3 respostas
S

oi gente,

sou iniciante no java, e tbm no forum, como podem ver no numero de mensages ai ao lado.
estou usando o framework struts, e naum to conseguindo resolver o seguinte probleminha:

javax.servlet.ServletException: Exception creating bean of class br.caelum.struts.form.ContatoForm: {1}
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
	org.apache.jsp.novo_jsp._jspService(novo_jsp.java:74)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

um pedaço do meu meu struts-config:

(...)

    <form-bean
    	name="ContatoForm"
    	type="br.caelum.struts.form.ContatoForm"/>

(...)

		<action
			path="/listacontatos"
			type="br.com.caelum.struts.action.ListaContatosAction">
				<forward name="lista" path="/lista.jsp"/>
		</action>

		<action
			name="ContatoForm"
			input="/novo.jsp"
			path="/novoContato"
			type="br.com.caelum.struts.action.AdicionaContatoAction"
			scope="request">
				<forward name="ok" path="/listaContatos.do"></forward>
		</action>

(...)

e minha classe ContatoForm:

package br.com.caelum.struts.form;

import javax.servlet.http.HttpServletRequest;
import org.apache.struts.action.*;
import br.com.caelum.jdbc.modelo.Contato;

public class ContatoForm extends ActionForm {

	private Contato contato = new Contato();
	
	public Contato getContato() {
		return this.contato;
	}
	
	public boolean stringVazia(String s) {
		return s == null || s.trim().length() == 0;
	}
	
	public ActionErrors validate(ActionMapping map, HttpServletRequest req) {
		ActionErrors erros = new ActionErrors();
		if (stringVazia(contato.getNome())) {
			erros.add("nome", new ActionMessage("erro.campoNome"));
		}
		if (stringVazia(contato.getEmail())) {
			erros.add("email", new ActionMessage("erro.campoEmail"));
		}
		if (stringVazia(contato.getEndereco())) {
			erros.add("endereco", new ActionMessage("erro.campoEndereco"));
		}
		return erros;
	}

}

alguem poderia me ajudar?
Desde já, agradeço.

3 Respostas

J

Tente colocar tambem o metodo reset():

public void reset(ActionMapping map, HttpServletRequest req) { 

}
S

ei jairelton,

obrigado. mas, coloquei o metodo, e continua c/ o mesmo erro… :cry:
q pode ser?

C

Alguém conseguiu resolver este problema?

Criado 22 de agosto de 2006
Ultima resposta 27 de ago. de 2009
Respostas 3
Participantes 3