I think I've found a solution.
I'll make an object (eventualy a struts PlugIn), DBMessage which receivies a
connection from my connection pool and retrives the error messages from the
database, and this object will not extend MessageRessources.
Then in my actions I'll have :

DbMessage dbmesg = (DbMessage)servlet.getAttribute("DBMESG");
String  message = dbmesg.getMessage("error_code");
ActionErrors errors = new ActionError();
errors.add("code",new ActionError("foo",message));

where foo is defined in my application.properties as
foo = {0}

How that sounds ?


Ovidiu

----- Original Message ----- 
From: "James Mitchell" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, October 30, 2003 7:18 PM
Subject: RE: Connection pool and MessageRessources


> Hi Ovidiu
>
> I also wrote my own DBMessageResources.  With a simple hack, I was able
> to overcome the limitations of the existing API.
>
> The source code and example are available for download at:
>
>
> http://sourceforge.net/project/showfiles.php?group_id=49385&release_id=1
> 54972
>
>
>
> --
> James Mitchell
> Software Engineer / Struts Evangelist
> http://www.struts-atlanta.org
> 678.910.8017 (c)
> 770.822.3359 (h)
> AIM:jmitchtx
>
>
>
>
> > -----Original Message-----
> > From: Ovidiu EFTIMIE [mailto:[EMAIL PROTECTED]
> > Sent: Thursday, October 30, 2003 1:07 PM
> > To: [EMAIL PROTECTED]
> > Subject: Connection pool and MessageRessources
> >
> >
> > Hi,
> > I'm working with Struts 1.1 and I have a problem with the
> > MessageRessource and I
> > don't know to handle it  the right way.
> > In my application I have two constraints,among others :) ,
> > - i must use an oci connection to the database
> > - the error messages will be stored in the database
> > For that I took two aproaches :
> > ## One ##:  I have written a Struts plugin which builds the
> > connection pool, and
> > I've extended MessageRessourceFactory and MessageRessources
> > with my own classes
> > DBRessourceFactory and DBRessource to have my own mechanism
> > for message
> > retrivial. My problem is now how can I get a connection to
> > the database from the
> > connection pool I've just made ? Is there a way to
> > communicate between my plugin
> > and my DBRessource class ?
> >
> >
> > ## Two ##: I make a class which will handle the connection
> > pool creation and the
> > retrivial of messages from the database.
> > It will look like this :
> > public class MessagesDBPool extends MessageRessources implements
> > PlugIn,Serializable {
> >     public MessageDBPool (){
> >         super();
> >     }
> >     public MessageDBPool(MessageRessourcesFactory
> > factory,String config){
> >         this(factory,config,false);
> >     }
> >     public MessageDBPool(MessageRessourcesFactory
> > factory,String config,boolean
> > returnNull){
> >         super(factory,config,returnNull);
> >     }
> >     public void init(ActionServlet servlet, ModuleConfig
> > config) throws
> > ServletException{
> >         //pool initialisation here
> >     }
> >     public void destroy(){
> >         //destroy pool here
> >     }
> > }
> > Can I do this in the first place ?
> >
> > Now the question is which one of this two solutions can work?
> > Is there another
> > way to do this ?
> > Any suggestions are welcome .
> >
> > Thanks,
> > Ovidiu EFTIMIE
> >
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


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

Reply via email to