struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <Craig.McClana...@eng.sun.com>
Subject Re: Simple Strut Application Throws Exception
Date Fri, 16 Jun 2000 19:00:23 GMT
David Geary wrote:

> I'm having problems getting the simplest of struts applications to work.
> Here it is:
>
> <%-- test.jsp --%>
> <%@ taglib uri='/WEB-INF/struts.tld' prefix='struts' %>
> <struts:message key='one.resource'/>
>
> I have followed the directions for installing and using struts from the
> readme file, but I'm getting the following exception:
>
> javax.servlet.jsp.JspException: Missing resources attribute
> org.apache.struts.action.MESSAGE at
> org.apache.struts.taglib.MessageTag.doStartTag(MessageTag.java:332) at
> _jsp._struts_22dsimple_22dexample._test__jsp._jspService(/struts-simple-example/test.jsp:1)
>

In the tomcat.log file I'll bet you will find an error complaining about not being able to
load
the application resources.  The reason is that the "resources.properties" file needs to be
in
the application class path (it is typically put in the same place all the *.class files for
your application are).

Either put this file into WEB-INF/classes, or put it inside a JAR file in WEB-INF/lib.

Craig McClanahan


>
> ...
>
> The exception is thrown because the attribute named Action.MESSAGES_KEY
> cannot be found in application scope by MessageTag.doStartTag().
> However, servlet.log seems to indicate that the resource bundle was
> loaded by the action servlet; here's what it says: Loading application
> resources from bundle resources
>
> The fact that there is no org.apache.struts.action.MESSAGE (it's
> MESSAGES_KEY) makes me suspicious, although that could just be a typo.
> I'm using the June 15 download of struts, JDK 1.2.2, and Tomcat 3.1 on
> Windows NT. I get the same results with Resin.
>
> Here's how the application is structured:
>
> .:
> test.jsp
> web-inf
>
> ./web-inf:
> lib
> resources.properties
> struts.tld
> web.xml
>
> ./web-inf/lib:
> struts.jar
>
> The web-inf/resources.properties file defines one.resource (only), and
> struts.tld and struts.jar were copied from the example source. web.xml
> looks like this:
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
>
> <!DOCTYPE web-app
>   PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
>   "http://java.sun.com/j2ee/dtds/web-app_3.2.dtd">
>
> <web-app>
>
>   <!-- Action Servlet Configuration -->
>   <servlet>
>     <servlet-name>action</servlet-name>
>
> <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>     <init-param>
>       <param-name>application</param-name>
>       <param-value>resources</param-value>
>     </init-param>
>     <init-param>
>       <param-name>debug</param-name>
>       <param-value>2</param-value>
>     </init-param>
>     <load-on-startup>2</load-on-startup>
>   </servlet>
>
>   <!-- Action Servlet Mapping -->
>   <servlet-mapping>
>     <servlet-name>action</servlet-name>
>     <url-pattern>*.do</url-pattern>
>   </servlet-mapping>
>
>   <!-- Application Tag Library Descriptor
>    Uncomment this if your application has custom tags ...
>   <taglib>
>     <taglib-uri>/WEB-INF/app.tld</taglib-uri>
>     <taglib-location>/WEB-INF/app.tld</taglib-location>
>   </taglib>
>   -->
>
>   <!-- Struts Tag Library Descriptor -->
>   <taglib>
>     <taglib-uri>/WEB-INF/struts.tld</taglib-uri>
>     <taglib-location>/WEB-INF/struts.tld</taglib-location>
>   </taglib>
>
> </web-app>
>
> Any ideas?  Thanks,
>
> david


Mime
View raw message