I agree absolutely - however, MessageResources has been pulled into commons-messages which lends to using it more freely (though I haven't found a reason to use that yet over ResourceBundle.getBundle() - since it doesn't do any sort of automatic discovery of property files you still have to provide a filename in your code).
-----Original Message----- From: David Graham [mailto:dgraham1980@;hotmail.com] Sent: Friday, November 15, 2002 15:27 To: [EMAIL PROTECTED] Subject: RE: giving biz classes access to MessageResources? But you don't want to use MessageResources in your business class because then you're tied to struts. Never import javax.servlet.* or org.apache.struts.* in business logic classes. David >From: "Andy Kriger" <[EMAIL PROTECTED]> >Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >To: "Struts Users Mailing List" <[EMAIL PROTECTED]> >Subject: RE: giving biz classes access to MessageResources? >Date: Fri, 15 Nov 2002 15:16:10 -0500 > >to answer my own question - yes, using >PropertyResourceBundle.getBundle(<appResFile>) and i'm guessing if i look >further MessageResources has a static utility method that does this > >-----Original Message----- >From: Andy Kriger [mailto:akriger@;greaterthanone.com] >Sent: Friday, November 15, 2002 14:57 >To: Struts Users Mailing List; [EMAIL PROTECTED] >Subject: RE: giving biz classes access to MessageResources? > > >I'm talking about a generic class outside of the struts architecture that >knows nothing about where the strings are coming from (except that they >come >from a properties file). So I don't have knowledge of Action or >MessageResources or pageContext. > >-----Original Message----- >From: edgar [mailto:edgar@;blue-moose.net] >Sent: Friday, November 15, 2002 14:50 >To: 'Struts Users Mailing List' >Subject: RE: giving biz classes access to MessageResources? > > >You can get the app.properties as long as you have the request > > MessageResources mr = (MessageResources) >pageContext.findAttribute( Action.MESSAGES_KEY ); > >The MESSAGES_KEY is static so you don't need the action. > >-----Original Message----- >From: Andy Kriger [mailto:akriger@;greaterthanone.com] >Sent: Friday, November 15, 2002 2:24 PM >To: 'Struts Users Mailing List' >Subject: giving biz classes access to MessageResources? > > >I have an organizational question. On my current project, we keep SQL >queries in our App.properties file to allow us to update the queries >without recomiling code. However, this means that (afaik) only the >Action can access the query Strings. So, whenever calls are made to our >dB class, we have to pass the query as a parameter. > >Or do we? >The dB is a bunch of static methods (could be a singleton just as >easily). Is there a better way to set this up that allows the dB class >to know about the message resources? Will a call to System.getResource >work here? How are other folks handling this kind of thing? > >thx >andy > > > >-- >To unsubscribe, e-mail: ><mailto:struts-user-unsubscribe@;jakarta.apache.org> >For additional commands, e-mail: ><mailto:struts-user-help@;jakarta.apache.org> > > >-- >To unsubscribe, e-mail: ><mailto:struts-user-unsubscribe@;jakarta.apache.org> >For additional commands, e-mail: ><mailto:struts-user-help@;jakarta.apache.org> > > > >-- >To unsubscribe, e-mail: ><mailto:struts-user-unsubscribe@;jakarta.apache.org> >For additional commands, e-mail: ><mailto:struts-user-help@;jakarta.apache.org> > > > >-- >To unsubscribe, e-mail: ><mailto:struts-user-unsubscribe@;jakarta.apache.org> >For additional commands, e-mail: ><mailto:struts-user-help@;jakarta.apache.org> _________________________________________________________________ Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:struts-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>