I haven't done this, but if you look in the comments at the start of
ActionServlet it say you need to add a "factory" parameter to the web.xml
file, something like this:

  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>application</param-name>
      <param-value>myApp.ApplicationResources</param-value>
    </init-param>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>factory</param-name>
      <param-value>myPackage.myMessageResourcesFactory</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>

Niall

> -----Original Message-----
> From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
> Sent: 24 May 2001 00:13
> To: [EMAIL PROTECTED]
> Subject: RE: <html:errors/> tag
>
>
> Hi
> I have written a subclass of
> org.apache.struts.util.MessageResources  and also
> a subclass of org.apache.struts.util.MessageResourcesFactory,
> and made my implementation so that when <html:errors/> tag is
> called it gets
> the error message from my database instead of the
> ActionResources.properties
> file.
>
> But the problem that I have got now is, How do I set that up in Struts and
> which XML file or other file have I to modify.
> Could you please help me out in this.
>
> Thanks
> Kanna
>
>
>
>
>
> You can subclass org.apache.struts.util.MessageResources to
> provide your own
> "database" implementation of a resource bundle (as opposed to the common
> "properties" implementation via
> org.apache.struts.util.PropertyMessageResources), put an instance of your
> subclass in a servlet context (application-scope) attribute, and then use
> the <html:errors> tag's "bundle" attribute to specify the name you gave to
> the servlet context (application-scope) attribute.
>
> At least that should be the theory behind it, though I have not done it
> myself.
>
> -- Stoehr
>
> P.S.  You could also have the application resource bundle be an
> instance of
> your MessageResources subclass by creating a subclass of
> org.apache.struts.util.MessageResourcesFactory that creates instances of
> your MessageResources subclass, and then specify the new factory in the
> ActionServlet's "factory" init parameter.
>
>
> -----Original Message-----
> From: SESHADRI Sudarshan [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, May 22, 2001 03:52 AM
> To: '[EMAIL PROTECTED]'
> Subject: RE: html:errors/> tag
>
>
> Hi Kanna
>
> please send me the answer if u find it.
>
> thanks
>
> Sudarshan
>
> > tks
> >
> > Sudarshan
> > Tel:  office  : 9218 6823    Fax: 9218 6455 / 9218 6916
> > Email:  [EMAIL PROTECTED]
>
>
> -----Original Message-----
> From: Muthu Kannappan [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, 23 May 2001 8:42
>
>
> To: [EMAIL PROTECTED]
> Subject: html:errors/> tag
>
>
> Hi
> I have been trying to use struts and wanted to use the <html:errors/> tag.
> I wanted to the error messages to be read from a database instead of the
> ActionResources properties file. Could you let me know
> what exactly I am suppose to do to achive that.
> I wanted to changed the code at the place where it was looking for the
> properties files and make it look into the database.
> Could any one suggest me how to do that or has anybody done that already.
>
> Thanks
> Kanna
>
>
> ____________________________________________________________________
> Get free email and a permanent address at http://www.netaddress.com/?N=1
>

Reply via email to