Hello, I was trying to do this just for curiosity - learning struts. My intent was just to log an error message when someone (webdesigner/me :-)) tries to call my ChangeLang action with wrong parameters. Say, I have ApplicationResources.properties (English messages/texts) and ApplicationResources_sk.properties (Slovak messages/texts). When I call myapp/changeLang?lang=sk, it changes to Slovak languages, when lang=en, it changes back. That's ok, everything works, no error logged. When lang=anything_else, it changes to default (English in this case). But I want to log an error message, that there was attempt to change language to something for which I don't have .properties file. So I wanted to get the name of .properties files form resource-messages element, add "_" + anything_else + ".properties", check if that file exists and log error message. This the first what comes to my mind...
I will look at that two sources, but I think it's not so important for me to get it working... I want to continue in my struts learning and maybe later I will understand all this things. But I wulod like to thank you very much for your time. With best regards -jerryk. ===================== Juraj Kazda ICQ : 135207538 ===================== > -----Original Message----- > From: James Mitchell [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, September 17, 2002 6:18 PM > To: Struts Users Mailing List > Subject: RE: The name of application resources? > > > Take a look at the source code for MessageResources and it's default > implementation PropertyMessageResources. You'll gain an > appreciation for > why this won't work (by default) and doing it yourself would > be (what I > consider) a non-supported modification ;) > > I'm not trying to discourage you. I know exactly how to do > this. I just > can't see WHY you need to do this. > > I've written my own MessageResources implementation > (DBMessageResources) > which allows you to store and retrieve the key-value pairs in > a database. > I'm almost finished with the second (XMLMessageResources). > > Good luck with it and let me know what you decide. > > Cheers, > > James "Sasquatch on crack" Mitchell > Software Engineer\Struts Evangelist > Struts-Atlanta, the "Open Minded Developer Network" > http://www.open-tools.org/struts-atlanta > > > > > > -----Original Message----- > > From: Juraj Kazda [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, September 17, 2002 10:36 AM > > To: Struts Users Mailing List > > Subject: RE: The name of application resources? > > > > > > Hello James. > > > > Yes, I suppose to use it in action class. This action class is > > responsible for changing the Locale/language of application. I know, > > that if I try to change to language which appropriate > message file is > > not available, default .properties file will be used. However, I use > > logging in my action class and I want to log something like > - "No such > > resources available". I just want to try to check if that > file exists > > (the name from message-resource element + parameter from > reguest) and if > > not, log that. > > > > -jerryk. > > > > > > > > ===================== > > Juraj Kazda > > ICQ : 135207538 > > ===================== > > > > > > > -----Original Message----- > > > From: James Mitchell [mailto:[EMAIL PROTECTED]] > > > Sent: Tuesday, September 17, 2002 4:27 PM > > > To: Struts Users Mailing List > > > Subject: RE: The name of application resources? > > > > > > > > > Perhaps it would be better to explain what you want to do > > > before you do > > > this. > > > > > > Why do you need to extract the name? Are you needing this in > > > your action > > > class? > > > > > > James Mitchell > > > Software Engineer\Struts Evangelist > > > Struts-Atlanta, the "Open Minded Developer Network" > > > http://www.open-tools.org/struts-atlanta > > > > > > > > > > > > > > > > -----Original Message----- > > > > From: Juraj Kazda [mailto:[EMAIL PROTECTED]] > > > > Sent: Tuesday, September 17, 2002 9:05 AM > > > > To: STRUTS-USER (E-mail) > > > > Subject: The name of application resources? > > > > > > > > > > > > Hello everyone, > > > > > > > > I'm new to Struts and while discovering its magic I have > > > short question: > > > > > > > > > > > > Is it possible to get the name of file with internationalized > > > > messages (ie. ApplicationResources.properties, or > > > generally, the name > > > > set up in message-resources element of strusts-config.xml)? > > > > > > > > > > > > I found something like > org.apache.struts.config.MessageResources in > > > > documentation, but how can I obtain instance of this > class valid for > > > > actual application? > > > > > > > > Thank you very much. > > > > > > > > > > > > -jerryk. > > > > > > > > > > > > > > > > > -- > > > 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]>
smime.p7s
Description: application/pkcs7-signature