Erro criando formulario

0 respostas
vjfenix

Olá pessoal,

Estou criando um formulario utilizando os conceitos de struts porém está me dando um erro, se alguém puder me ajudar..

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: An exception occurred processing JSP page /novo.jsp at line 5
2:
3:
4:
5:
6:
7:

8:

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null on action /novoCandidato
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:850)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779)
org.apache.jsp.novo_jsp._jspService(novo_jsp.java:72)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
root cause
javax.servlet.jsp.JspException: Cannot retrieve definition for form bean null on action /novoCandidato
org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:731)
org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:419)
org.apache.jsp.novo_jsp._jspx_meth_html_005fform_005f0(novo_jsp.java:143)
org.apache.jsp.novo_jsp._jspx_meth_html_005fhtml_005f0(novo_jsp.java:97)
org.apache.jsp.novo_jsp._jspService(novo_jsp.java:65)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:337)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.16 logs.


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

Apache Tomcat/6.0.16

***********************************************************************
public class CandidatoForm extends ActionForm{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private CandidatoVo candidato = new CandidatoVo();

	public CandidatoVo getCandidato() {
		return candidato;
	}

	public void setCandidato(CandidatoVo candidato) {
		this.candidato = candidato;
	}

}
**********************************************************************
public class AdicionaCandidatoAction extends Action{
	
	@Override
	public ActionForward execute(ActionMapping map, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		CandidatoForm formulario = ((CandidatoForm) form);
		
		CandidatoVo candidato = formulario.getCandidato();
		CandidatoHblDao dao = new  CandidatoHblDao();
		dao.inserir(candidato);
		return map.findForward("sucesso");
	}

}
***********************************************************************
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"         "http://struts.apache.org/dtds/struts-config_1_2.dtd">
<struts-config>
	
	<form-beans>
		<form-bean name="CandidatoForm" type="br.com.csj.struts.form.CandidatoForm"/>
	</form-beans>

	<action-mappings>
		
		<action path="/lista"
			type="br.com.csj.struts.action.ListaCandidatoAction">
			<forward name="lista" path="/lista.jsp" />
		</action>
		
		<action path="/novoCandidato"
			type="br.com.csj.struts.action.AdicionaCandidatoAction">
			<forward name="sucesso" path="/lista.do" />
		</action>
		
	</action-mappings>
</struts-config>
**********************************************************************
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<html:html>
	
<html:errors/>
	<html:form action="/novoCandidato" focus="cadastro.nome">
	
	Nome:
	<html:text property="cadastro.nome"></html:text>
	<br/>
	
	Endereco:
	<html:text property="cadastro.endereco"></html:text>
	<br/>
	
	
	</html:form>
</html:html>
Criado 11 de julho de 2008
Respostas 0
Participantes 1