Hi,
The ActionServlet loads one resourcefile and stores the information at the 
servletcontext.

One solution is to have your own "Startup-servlet" to load extra resources to the 
servlet context. You can access those later within your application. If you use Tomcat 
4 (Have access to Servlet 2.3 features) you can write a contextlistener instead.

>From Servlet init method:

    ServletContext ctx = config.getServletContext();
    MessageResourcesFactory myFactory = 
(MessageResourcesFactory)MessageResourcesFactory.createFactory();
    MessageResources errMsgs = 
(MessageResources)myFactory.createResources(config.getInitParameter(("errors")));
    MessageResources wrnMsgs = 
(MessageResources)myFactory.createResources(config.getInitParameter(("warnings")));

ctx.setAttribute "myapp.errors",errMsgs);
ctx.setAttribute("myapp.warnings",wrnMsgs);

web.xml servlet definition:
<servlet>
  <servlet-name>mystartup</servlet-name>
  <servlet-class>se.bluefish.StartupServlet</servlet-class>
  <init-param>
          <param-name>errors</param-name>
          <param-value>com.bluefish.MyErrorResources</param-value>
  </init-param>
  <init-param>
          <param-name>warnings</param-name>
          <param-value>com.bluefish.MyWarningResources</param-value>
  </init-param>
  <load-on-startup>2</load-on-startup>
</servlet>

Rgds // Torben

> 
> 
> Not yet. James Holmes is looking into it.
> 
> 
> At 11:47 am 31-10-2001 +0530, you wrote:
> >Hello All,
> >
> >How can I have multiple resource files ?
> >
> >I am trying something like
> >
> ><web-app>
> ><servlet>
> >  <init-param>
> >   <param-name>application</param-name>
> >   <param-value>com.abhi.hello.HelloWorld1Resources</param-value>
> >  </init-param>
> >  <init-param>
> >   <param-name>application</param-name>
> >   <param-value>com.abhi.hello.HelloWorld2Resources</param-value>
> >  </init-param>
> ><servlet>
> ><web-app>
> >
> >But my jsp pages do not find any of the keys defined in the resources files.
> >If I define only one file and put everything there then everything works
> >fine.
> >
> >regards,
> >Abhishek.
> 
> -- 
> John Yu                       Scioworks Technologies
> e: [EMAIL PROTECTED]         w: +(65) 873 5989
> w: http://www.scioworks.com   m: +(65) 9782 9610
> 
> Scioworks Camino - "Rapid WebApp Assembly for Struts"
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
> 
> 


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to