You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sebastião Carlos Santos <sc...@bol.com.br> on 2004/08/27 00:28:42 UTC

Problems with Struts - newbie

I am starting to work with struts, however I come facing some problems that I will describe to follow:

I have the following code in the archive index.jsp

<%@ taglib uri="/WEB-INF/tags/struts/struts-logic.tld" prefix="logic" %> 
<%@ taglib uri="/WEB-INF/tags/struts/struts-bean.tld" prefix="bean" %> 
<%@ taglib uri="/WEB-INF/tags/struts/struts-html.tld" prefix="html" %> 

<html:html locale="true"> 
  <head> 
    <html:base/> 
      <title><bean:message key="global.title"/></title> 
  </head> 
  <body> 
  </body> 
</html:html> 

The archive /WEB-INF/web.xml is configured of the following form:

<?xml version="1.0" encoding="UTF-8"?> 

<!DOCTYPE web-app 
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" 
   "http://java.sun.com/dtd/web-app_2_3.dtd"> 

<web-app> 
  <servlet> 
    <servlet-name>action</servlet-name> 
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class> 
    <init-param> 
      <param-name>config</param-name> 
      <param-value>/WEB-INF/struts-config.xml</param-value> 
    </init-param> 
    <init-param> 
      <param-name>debug</param-name> 
      <param-value>2</param-value> 
    </init-param> 
    <init-param> 
      <param-name>details</param-name> 
      <param-value>2</param-value> 
    </init-param> 
    <init-param> 
      <param-name>validating</param-name> 
      <param-value>true</param-value> 
    </init-param> 
    <load-on-startup>2</load-on-startup> 
  </servlet> 

  <servlet-mapping> 
    <servlet-name>action</servlet-name> 
    <url-pattern>*.do</url-pattern> 
  </servlet-mapping> 

  <welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
  </welcome-file-list> 

  <taglib> 
    <taglib-uri>/WEB-INF/tags/struts/struts-bean.tld</taglib-uri> 
    <taglib-location>/WEB-INF/tags/struts/struts-bean.tld</taglib-location> 
  </taglib> 
  <taglib> 
    <taglib-uri>/WEB-INF/tags/struts/struts-html.tld</taglib-uri> 
    <taglib-location>/WEB-INF/tags/struts/struts-html.tld</taglib-location> 
  </taglib> 
  <taglib> 
    <taglib-uri>/WEB-INF/tags/struts/struts-logic.tld</taglib-uri> 
    <taglib-location>/WEB-INF/tags/struts/struts-logic.tld</taglib-location> 
  </taglib> 
  <taglib> 
    <taglib-uri>/WEB-INF/tags/struts/struts-nested.tld</taglib-uri> 
    <taglib-location>/WEB-INF/tags/struts/struts-nested.tld</taglib-location> 
  </taglib> 
  <taglib> 
    <taglib-uri>/WEB-INF/tags/struts/struts-template.tld</taglib-uri> 
    <taglib-location>/WEB-INF/tags/struts/struts-template.tld</taglib-location> 
  </taglib> 
  <taglib> 
    <taglib-uri>/WEB-INF/tags/struts/struts-tiles.tld</taglib-uri> 
    <taglib-location>/WEB-INF/tags/struts/struts-tiles.tld</taglib-location> 
  </taglib> 

  <description>Embragec</description> 
  <resource-ref> 
    <description>DataSource</description> 
    <res-ref-name>jdbc/campinaverde</res-ref-name> 
    <res-type>javax.sql.DataSource</res-type> 
    <res-auth>Container</res-auth> 
  </resource-ref> 
</web-app> 


The archive struts-config.xml is configured as listed below:

<?xml version="1.0"?> 

<!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="Embragec" null="false"/> 

</struts-config> 


The archive properties if finds in /WEB-INF/classes with the name of Embragec.properties

When I call the archive index.jsp in the navigator I receive the following message from error:

javax.servlet.jsp.JspException: Cannot find message resources under key org.apache.struts.action.MESSAGE 
   org.apache.struts.util.RequestUtils.retrieveMessageResources(RequestUtils.java:1103) 
   org.apache.struts.util.RequestUtils.message(RequestUtils.java:1043) 
   org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:294) 
   org.apache.jsp.index_jsp._jspx_meth_bean_message_0(index_jsp.java:143) 
   org.apache.jsp.index_jsp._jspx_meth_html_html_0(index_jsp.java:102) 
   org.apache.jsp.index_jsp._jspService(index_jsp.java:69) 
   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) 


Some idea of that it can be happening?
Thank´s


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: Problems with Struts - newbie

Posted by David Friedman <hu...@ix.netcom.com>.
Dear S.C.S,

You listed a struts-config.xml message resource as "Embragec" so it needs to
find a file "WEB-INF\classes\Embragec.properties" yet you didn't list that
file with sample contents.  Instead, you seem to have listed "Embragec" as a
JDBC (container level) resource.  I don't believe Struts resources can pull
from a database, not unless this is something new in the 1.2.X release(s) or
you have some special sort of plugIn.

Regards,
David

-----Original Message-----
From: Sebastião Carlos Santos [mailto:scarlosantos@bol.com.br]
Sent: Thursday, August 26, 2004 6:29 PM
To: user@struts.apache.org
Subject: Problems with Struts - newbie


I am starting to work with struts, however I come facing some problems that
I will describe to follow:

I have the following code in the archive index.jsp

<%@ taglib uri="/WEB-INF/tags/struts/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tags/struts/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tags/struts/struts-html.tld" prefix="html" %>

<html:html locale="true">
  <head>
    <html:base/>
      <title><bean:message key="global.title"/></title>
  </head>
  <body>
  </body>
</html:html>

The archive /WEB-INF/web.xml is configured of the following form:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app
   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
   "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>details</param-name>
      <param-value>2</param-value>
    </init-param>
    <init-param>
      <param-name>validating</param-name>
      <param-value>true</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>

  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <taglib>
    <taglib-uri>/WEB-INF/tags/struts/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/tags/struts/struts-bean.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/tags/struts/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/tags/struts/struts-html.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/tags/struts/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/tags/struts/struts-logic.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/tags/struts/struts-nested.tld</taglib-uri>

<taglib-location>/WEB-INF/tags/struts/struts-nested.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/tags/struts/struts-template.tld</taglib-uri>

<taglib-location>/WEB-INF/tags/struts/struts-template.tld</taglib-location>
  </taglib>
  <taglib>
    <taglib-uri>/WEB-INF/tags/struts/struts-tiles.tld</taglib-uri>
    <taglib-location>/WEB-INF/tags/struts/struts-tiles.tld</taglib-location>
  </taglib>

  <description>Embragec</description>
  <resource-ref>
    <description>DataSource</description>
    <res-ref-name>jdbc/campinaverde</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref>
</web-app>


The archive struts-config.xml is configured as listed below:

<?xml version="1.0"?>

<!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="Embragec" null="false"/>

</struts-config>


The archive properties if finds in /WEB-INF/classes with the name of
Embragec.properties

When I call the archive index.jsp in the navigator I receive the following
message from error:

javax.servlet.jsp.JspException: Cannot find message resources under key
org.apache.struts.action.MESSAGE

org.apache.struts.util.RequestUtils.retrieveMessageResources(RequestUtils.ja
va:1103)
   org.apache.struts.util.RequestUtils.message(RequestUtils.java:1043)
   org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:294)
   org.apache.jsp.index_jsp._jspx_meth_bean_message_0(index_jsp.java:143)
   org.apache.jsp.index_jsp._jspx_meth_html_html_0(index_jsp.java:102)
   org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
   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:3
24)
   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)


Some idea of that it can be happening?
Thank´s


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org