exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /novo.jsp at line 15
12:
13: <html:errors/>
14:
15: <html:form action="/novoContato" focus="contato.nome">
16: Nome:
17: <html:text property="contato.nome"/>
18: <br/>
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:342)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
Segue junto os códigos e struts-config:
package br.com.illusionteam.struts.form;
import com.illusionteam.jdbc.Contato;
import org.apache.struts.action.ActionForm;
public class ContatoForm extends ActionForm{
private Contato contato = new Contato();
public Contato getContato() {
return this.contato;
}
}
package br.com.illusionteam.struts.action;
import br.com.illusionteam.struts.form.ContatoForm;
import com.illusionteam.jdbc.Contato;
import com.illusionteam.jdbc.ContatoDAO;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class AdicionaContatoAction extends Action{
@Override
public ActionForward execute(ActionMapping map, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
//log
System.out.println("Tentando adicionar contato...");
//formulário de cliente
ContatoForm formulario = ((ContatoForm) form);
//acessa o bean
Contato contato = formulario.getContato();
//adiciona ao banco de dados
ContatoDAO dao = new ContatoDAO();
dao.adicionar(contato);
//ok... visualização
return map.findForward("ok");
}
}
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<html:html>
<head><title>Sistema de Teste do Struts</title></head>
<html:errors/>
<html:form action="/novoContato" focus="contato.nome">
Nome:
<html:text property="contato.nome"/>
<br/>
E-mail:
<html:text property="contato.email"/>
<br/>
Endereço:
<html:text property="contato.endereco"/>
<br/>
<html:submit>Enviar dados</html:submit>
</html:form>
</html:html>
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<form-beans>
<form-bean>
<form-bean name="ContatoForm" type="br.com.illusionteam.struts.form.ContatoForm"/>
</form-bean>
</form-beans>
<global-exceptions>
</global-exceptions>
<global-forwards>
<forward name="welcome" path="/Welcome.do"/>
</global-forwards>
<action-mappings>
<action path="/Welcome" forward="/welcomeStruts.jsp"/>
<action path="/teste" type="br.com.illusionteam.struts.action.TesteSimplesAction">
<forward name="ok" path="/exemplo.jsp"/>
</action>
<action path="/listaContatos" type="br.com.illusionteam.struts.action.ListaContatosAction">
<forward name="lista" path="/lista.jsp"/>
<forward name="vazia" path="/lista-vazia.jsp"/>
</action>
<action path="/novoContato" name="ContatoForm" type="br.com.illusionteam.struts.action.AdicionaContatoAction">
<forward name="ok" path="/listaContatos.do"/>
</action>
</action-mappings>
<controller processorClass="org.apache.struts.tiles.TilesRequestProcessor"/>
<message-resources parameter="com/myapp/struts/ApplicationResource"/>
<!-- ========================= Tiles plugin ===============================-->
<plug-in className="org.apache.struts.tiles.TilesPlugin" >
<set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml" />
<set-property property="moduleAware" value="true" />
</plug-in>
<!-- ========================= Validator plugin ================================= -->
<plug-in className="org.apache.struts.validator.ValidatorPlugIn">
<set-property
property="pathnames"
value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml"/>
</plug-in>
</struts-config>
Alguém poderia me ajudar? Grato.