struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Adam Hardy <ahardy.str...@cyberspaceroad.com>
Subject Re: Hello World gone wrong
Date Mon, 17 Nov 2003 10:58:50 GMT
Hi Richard,
simply put, struts is not initializing the message resources until you 
call an action mapping. Since you go straight to hello.jsp direct, 
struts bean taglib doesn't have the resource bundle available.

See the output log below that comes at the point when I call 'hello.do', 
an action forward I configured in the struts-config to forward via 
struts action servlet to hello.jsp.

   <action-mappings>
     <action    path="/hello"
             forward="/helloworld.jsp">
     </action>
   </action-mappings>

You can see from the output log that struts is setting up the bundles 
for itself and for your app when you go through struts for the first time.

HTH
Adam

PS you need at least commons-beanutils and commons-digester in your lib 
as well as struts.jar.


On 11/15/2003 09:12 AM Richard Morris wrote:
> I have tried a couple of other things trying to figure out why I can't 
> get this simple application to work correctly.  As you have generously 
> asked, I have attached the application in a jar file and the server.xml 
> file I have used.
>  
> Here is the exception from the log that I am receiving under the Tomcat 
> 5 configuration:
>  
> 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)

INFO 11:49:13 org.apache.struts.util.PropertyMessageResources.<init>(): 
Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
INFO 11:49:13 org.apache.struts.util.PropertyMessageResources.<init>(): 
Initializing, config='org.apache.struts.action.ActionResources', 
returnNull=true
FINE 11:49:13 org.apache.struts.action.ActionServlet.initServlet(): 
Scanning web.xml for controller servlet mapping
FINE 11:49:13 
org.apache.struts.action.ActionServlet.addServletMapping(): Process 
servletName=action, urlPattern=*.do
FINE 11:49:13 org.apache.struts.action.ActionServlet.initServlet(): 
Mapping for servlet 'action' = '*.do'
FINE 11:49:13 org.apache.struts.action.ActionServlet.initModuleConfig(): 
Initializing module path '' configuration from '/WEB-INF/struts-config.xml'
FINE 11:49:13 
org.apache.struts.action.ActionServlet.initModuleMessageResources(): 
Initializing module path '' message resources from 
'HelloWorldMessageResources'
INFO 11:49:13 org.apache.struts.util.PropertyMessageResources.<init>(): 
Initializing, config='HelloWorldMessageResources', returnNull=true
FINE 11:49:13 
org.apache.struts.action.ActionServlet.initModuleDataSources(): 
Initializing module path '' data sources
FINE 11:49:13 
org.apache.struts.action.ActionServlet.initModulePlugIns(): Initializing 
module path '' plug ins
FINE 11:49:13 org.apache.struts.util.RequestUtils.getModuleName(): Get 
module name for path /hello.do
FINE 11:49:13 org.apache.struts.util.RequestUtils.getModuleName(): 
Module name found: default
FINE 11:49:13 org.apache.struts.action.RequestProcessor.process(): 
Processing a 'GET' for path '/hello'
FINE 11:49:13 
org.apache.struts.action.RequestProcessor.internalModuleRelativeForward(): 
  Delegating via forward to '/hello.jsp'
INFO 11:49:13 org.apache.struts.util.PropertyMessageResources.<init>(): 
Initializing, config='org.apache.struts.taglib.html.LocalStrings', 
returnNull=true
INFO 11:49:13 org.apache.struts.util.PropertyMessageResources.<init>(): 
Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
INFO 11:49:13 org.apache.struts.util.PropertyMessageResources.<init>(): 
Initializing, config='org.apache.struts.taglib.bean.LocalStrings', 
returnNull=true
FINE 11:49:13 
org.apache.struts.util.PropertyMessageResources.getMessage(): 
getMessage(en,title.helloworld)
FINEST 11:49:13 
org.apache.struts.util.PropertyMessageResources.loadLocale(): loadLocale(en)
FINEST 11:49:13 
org.apache.struts.util.PropertyMessageResources.loadLocale():   Loading 
resource 'HelloWorldMessageResources_en.properties'
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale():   Loading 
resource completed
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale(): 
loadLocale(en_US)
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale():   Loading 
resource 'HelloWorldMessageResources_en_US.properties'
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale():   Loading 
resource completed
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale(): loadLocale()
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale():   Loading 
resource 'HelloWorldMessageResources.properties'
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale():   Loading 
resource completed
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale():   Saving 
message key '.title.helloworld
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale():   Saving 
message key '.label.helloworld
INFO 11:49:14 org.apache.struts.util.PropertyMessageResources.<init>(): 
Initializing, config='org.apache.struts.taglib.html.LocalStrings', 
returnNull=true
FINE 11:49:14 
org.apache.struts.util.PropertyMessageResources.getMessage(): 
getMessage(en,label.helloworld)
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale(): loadLocale(en)
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale(): 
loadLocale(en_US)
FINEST 11:49:14 
org.apache.struts.util.PropertyMessageResources.loadLocale(): loadLocale()


-- 
struts 1.1 + tomcat 5.0.12 + java 1.4.2
Linux 2.4.20 RH9


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


Mime
View raw message