Erro no Struts

Essa é a primeira aplicação utilizando Struts, a idéia é um login.
criei um arquivo index.htm que contém o formulário, ele irá fazer submit para Login.do … mas nem isso consigo ao chamar a página JSP vejam o erro:

type Exception report

message

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

exception

javax.servlet.ServletException: Exception creating bean of class br.com.enquete.actionform.UsuarioActionForm: {1}
	org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
	org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:93)
	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)

root cause

javax.servlet.jsp.JspException: Exception creating bean of class br.com.enquete.actionform.UsuarioActionForm: {1}
	org.apache.struts.taglib.html.FormTag.initFormBean(FormTag.java:563)
	org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:520)
	org.apache.jsp.index_jsp._jspx_meth_html_form_0(index_jsp.java:124)
	org.apache.jsp.index_jsp._jspService(index_jsp.java:82)
	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)

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

Esse é o meu bean:

<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <title>untitled</title>
  </head>
  <body>
  <html:errors />

  <html:form action="Login.do">
  <table width="350" border="1" cellpadding="0" cellspacing="0">
    <tr>
      <td><bean:message key="label.usuario.login" /></td>
      <td><html:text property="login" name="loginUser"/></td>
    </tr>
    <tr>
      <td><bean:message key="label.usuario.pass" /></td>
      <td><html:text property="senha" name="loginUser"/></td>
    </tr>
  </table>
  </html:form>

  </body>
</html>

tem solução? :grin:

Você configurou corretamente o UsuarioActionForm no xml ?


Estranho… rodando pelo JDeveloper, não funciona dá erro, montei um deploy e coloquei no tomcat que funciona certinho. Vejam o erro no JDev:

500 Internal Server Error
javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE
	at org.apache.struts.util.RequestUtils.retrieveMessageResources(RequestUtils.java:1103)
	at org.apache.struts.util.RequestUtils.message(RequestUtils.java:1043)
	at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:294)
	at _index._jspService(index.jsp:7)
	[/index.jsp]
	at oracle.jsp.runtime.HttpJsp.service(HttpJsp.java:139)
	at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:349)
	at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:509)
	at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:413)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
	at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:604)
	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:317)
	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:270)
	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHandler.java:112)
	at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
	at java.lang.Thread.run(Thread.java:534)

vejam o struts-config.xml

<?xml version = '1.0' encoding = 'windows-1252'?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
  <message-resources parameter="resource.ApplicationResources" />
  
  <form-beans>
    <form-bean name="userLogin" type="br.com.enquete.actionform.UsuarioActionForm" />    
  </form-beans>
  
  <action-mappings>
      <action path="/Login" 
              type="br.com.enquete.action.UsuarioAction" 
              scope="session" 
              input="/index.jsp" 
              name="userLogin">
          <forward name="sucesso" path="/logged.jsp" />
      </action>
  </action-mappings>

</struts-config>

nesse ultimo erro ta mostrando q ele nao achou a key “MESSAGE”.
dá uma olhada no seu arquivo resources se vc criou ela…