It is optional, but if you are using Struts and are not strickly adhering to the MVC/Model approach and having all requests go through the ActionServlet you have better use it. 
 
Most app servers won't load the servlet until it is requested, if you don't use load-on-startup.
 
I am assuming that she directly accessed the jsp.  Therefore, the ActionServlet was never requested and never instantiated.  The bean:message tag gets the page context for the current jsp and looks for the ResourceBundle.  This is "context" is being maintained by the container and since the ActionServlet was never instantiated the bean:message tag couldn't find it.
-----Original Message-----
From: Gogineni, Pratima [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 01, 2001 3:55 PM
To: '[EMAIL PROTECTED]'
Subject: RE: "html:message" tag

Jason - I assumed that load-on-startup is an optional element and only required to specify the order. i.e. if this is not specified the appserver loads teh servlet in any order it likes???
 
if this is the case then the actionservlet shoudl have been loaded before the jsp page was compiled unless - the jsp page was also specified in teh deployment descriptor to be precompiled?
 
-----Original Message-----
From: Jason Chaffee [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 01, 2001 3:41 PM
To: '[EMAIL PROTECTED]'
Subject: RE: "html:message" tag

Your ActionServlet needs to be loaded to create an instance of the ResourceBundle.  Therefore, if you were requesting a jsp page without going through the ActionServlet, there will not be a ResourceBundle in the servlet context because this happens when the ActionServlet is initialized.
-----Original Message-----
From: Sue Deng [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 01, 2001 1:47 PM
To: [EMAIL PROTECTED]
Subject: Re: "html:message" tag

I would like to share what I did wrong before:  I forgot to put the line "<load-on-startup>2</load-on-startup>" in web.xml file.  After I add this line, my jsp works.  So, why is this line so important for using bean:message lag?

Thanks,

-Sue

Jason Chaffee wrote:

 

I find the following configuration easier:

Simply put the the resouce file in /WEB-INF/classes directory.

Then change the deployment descriptor as follows:

   <servlet>
     <servlet-name>action</servlet-name>
     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
     <init-param>
       <param-name>application</param-name>
       <param-value>ApplicationResources</param-value>

Also, make sure there isn't a typo in your resource file or your jsp page.

-----Original Message-----
From: Sue Deng [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 01, 2001 11:51 AM
To: [EMAIL PROTECTED]
Subject: Re: "html:message" tag

I put my ApplicationResources.properties file in
/usr/local/tomcat/classes/net/covalent directory before.  Now i moved it to my
applications /WEB-INF/classes/net/covalent directory.  And I got "Missing message
for key logon.title" error, but the logon.title key is in the file.

Thanks,

-Sue
Ratnadeep Bhattacharjee wrote:

> Chances are the location of your ApplicationResource file is not where
> ActionServlet is looking for it. For example, if your web.xml looks as follows:
>
>   <servlet>
>     <servlet-name>action</servlet-name>
>     <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
>     <init-param>
>       <param-name>application</param-name>
>       <param-value>net.covalent.ApplicationResources</param-value>
>       ....
>       ....
>
> then the ApplicationResources.properties file should be in the
> WEB-INF/classes/net/covalent/ directory.
>
> Hope this helps.
>
> -Deep.
>
> >
> > I did not make any changes on the code.  What do you mean the "app
> > server"?  I am using jakarta-struts-1.0-b1 under Tomcat.  What should I
> > do now?
> >
> > Thanks,
> >
> > -Sue
> >
> > Jason Chaffee wrote:
> >
> > >  Have you made any changes to the code?  The ActionServlet should be
> > > creating the resource bundle and storing in the servlet context using
> > > this key. What app server are you using?  There could be a bug in how
> > > it stores objects in the servlet context, thus the ActionServlet can't
> > > find anything that has previously been stored there.
> > >
> > >      -----Original Message-----
> > >      From: Sue Deng [mailto:[EMAIL PROTECTED]]
> > >      Sent: Tuesday, May 01, 2001 9:39 AM
> > >      To: [EMAIL PROTECTED]
> > >      Subject: Re: "html:message" tag
> > >
> > >      Thanks, Jason.  But  when I use bean:message, I got "Cannot
> > >      find message resources under key
> > >      org.apache.struts.action.MESSAGE" error.
> > >
> > >      Thanks,
> > >
> > >      -Sue
> > >
> > >      Jason Chaffee wrote:
> > >
> > >     >
> > >     >
> > >     > it should be bean:message
> > >     >
> > >     > -----Original Message-----
> > >     > From: Sue Deng [mailto:[EMAIL PROTECTED]]
> > >     > Sent: Monday, April 30, 2001 5:26 PM
> > >     > To: [EMAIL PROTECTED]
> > >     > Subject: "html:message" tag
> > >     >
> > >     > Hi,
> > >     >
> > >     > I am trying to build form using struts taglib.  But I get
> > >     > "no such tag
> > >     > message  ..."error when I use "html:message" tag.  I found
> > >     > that
> > >     > struts-html.tld and struts-bean.tld files do not have a
> > >     > tag named
> > >     > "message", but the struts example uses that tag.  Why?
> > >     >
> > >     > Thanks,
> > >     >
> > >     > -Sue
> > >

Reply via email to