Re: Message Resources and Struts Modules (Partially Solved)
No, there is no bug. You can access message resources of of default module and ( message resources of other modules also if required). alvin antony wrote: Hello, I just tried to copy all message resources definitions to the default struts-config.xml and now they are no message resource definitions on the submodule struts config, everything is working, but a little bit unhandy to define message resources for a sub module some where else . Is this a bug in the current version or does it has some reasons for being so. If some of you have a better insight, please share. Thanks, Alvin alvin antony [EMAIL PROTECTED] wrote: Hi friends, I write a modularised Struts Application, which has one default module and an another with prefix 'admin'. I have defined a default message resource for the default module as given below, # struts-con fig.xml ## OK, it works fine. i use the resource with Now I am trying to add a new admin module and tried all the possible ways to make the following definition working, #struts-config-admin.xml -- when I try this gets an exception [ServletException in:/admin/verwaltung/index.jsp] Cannot find message resources under key messageresourcesadmin' I couldn't figure what I got here wrong. any help is very much appreciated. Thanks in advance, Alvin Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. -- Thanks Manish Singla x73166 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Message Resources and Struts Modules (Partially Solved)
Hello, I just tried to copy all message resources definitions to the default struts-config.xml and now they are no message resource definitions on the submodule struts config, everything is working, but a little bit unhandy to define message resources for a sub module some where else . Is this a bug in the current version or does it has some reasons for being so. If some of you have a better insight, please share. Thanks, Alvin alvin antony [EMAIL PROTECTED] wrote: Hi friends, I write a modularised Struts Application, which has one default module and an another with prefix 'admin'. I have defined a default message resource for the default module as given below, # struts-con fig.xml ## OK, it works fine. i use the resource with Now I am trying to add a new admin module and tried all the possible ways to make the following definition working, #struts-config-admin.xml -- when I try this gets an exception [ServletException in:/admin/verwaltung/index.jsp] Cannot find message resources under key messageresourcesadmin' I couldn't figure what I got here wrong. any help is very much appreciated. Thanks in advance, Alvin Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now. Yahoo! India Mobile: Ringtones, Wallpapers, Picture Messages and more.Download now.
Re: message-resources
At 7:58 PM +0200 10/8/03, Dries Plessers wrote: I have a file (countries.properties) which contain all value and representations. e.g.: AD=ANDORRA AG=ANTIGUA AM=ARMENIA How can use this resource file to create a html:select where the value equals the countryname and the representation the 2letters within the struts framework ? Thx ! I would suggest writing an implementation of org.apache.struts.action.PlugIn. When initialized, the plugin could read in the properties file and create a list of org.apache.struts.util.LabelValueBean objects and put that list into the servlet (application) context so that it's available to anyone who needs it. Using the set-property element in struts-config, you could make it so both the source of the properties file and the name under which it's stored in the servlet context are externally configurable, and then you'd have a generally reusable PlugIn which could take any Properties file and do this conversion to a List of LabelValue beans. Such a PlugIn might even be a welcome contribution to the Struts project, or perhaps the SourceForge project at struts.sourceforge.net. Even if you have to read the documentation on all this stuff, you could probably write it in a couple of hours at most. Joe PS the only hitch would probably be that the Properties file wouldn't return its members in a reliable order, so if you wanted things alphabetically, you might have to add some mechanism to create a sorted list from the collection of LVBeans. That wouldn't be much harder, but it would be one more step. -- Joe Germuska [EMAIL PROTECTED] http://blog.germuska.com We want beef in dessert if we can get it there. -- Betty Hogan, Director of New Product Development, National Cattlemen's Beef Association - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: message-resources
OOPS! I wasn't paying attention to which list I was on. :( This belongs here on struts-user, not struts-dev. -- Wendy Smoak -Original Message- From: Wendy Smoak Sent: Wednesday, October 08, 2003 11:23 AM To: Dries Plessers; [EMAIL PROTECTED] Subject: RE: message-resources Dries Plessers [mailto:[EMAIL PROTECTED] wrote: I have a file (countries.properties) which contain all value and representations. e.g.: AD=ANDORRA AG=ANTIGUA AM=ARMENIA How can use this resource file to create a html:select where the value equals the countryname and the representation the 2letters within the struts framework ? Properties implements Map, so if you do the usual to read in a .properties file, along the lines of... ClassLoader cl = MyAction.class.getClassLoader(); Properties props = new Properties(); InputStream input = cl.getResourceAsStream( countries.properties ); props.load( props ) ; Then you should be able to use the 'props' object with the html:select tag. Not that I've tried it, but it seems like it should work. Since countries will probably not change during runtime, you could do this in a ContextListener and put the Map in Application scope. That way it'll be there for everyone who needs it. -- Wendy Smoak Applications Systems Analyst, Sr. Arizona State University, PA, IRM - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: message-resources
I store this kind of info in db, and return it as collection to optionsCollection tag. hth, .V At 7:58 PM +0200 10/8/03, Dries Plessers wrote: I have a file (countries.properties) which contain all value and representations. e.g.: AD=ANDORRA AG=ANTIGUA AM=ARMENIA How can use this resource file to create a html:select where the value equals the countryname and the representation the 2letters within the struts framework ? Thx ! I would suggest writing an implementation of org.apache.struts.action.PlugIn. When initialized, the plugin could read in the properties file and create a list of org.apache.struts.util.LabelValueBean objects and put that list into the servlet (application) context so that it's available to anyone who needs it. Using the set-property element in struts-config, you could make it so both the source of the properties file and the name under which it's stored in the servlet context are externally configurable, and then you'd have a generally reusable PlugIn which could take any Properties file and do this conversion to a List of LabelValue beans. Such a PlugIn might even be a welcome contribution to the Struts project, or perhaps the SourceForge project at struts.sourceforge.net. Even if you have to read the documentation on all this stuff, you could probably write it in a couple of hours at most. Joe PS the only hitch would probably be that the Properties file wouldn't return its members in a reliable order, so if you wanted things alphabetically, you might have to add some mechanism to create a sorted list from the collection of LVBeans. That wouldn't be much harder, but it would be one more step. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: message-resources in Struts 1.0?
It is only possible if you have the source code ;) -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 770.822.3359 AIM:jmitchtx - Original Message - From: Bob Lee [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 2:50 PM Subject: message-resources in Struts 1.0? Is it possible to cleanly patch Struts 1.0 to use a custom message resources factory? Thanks, Bob - 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]
Re: message-resources in Struts 1.0?
Thanks, James. ;) If anyone out there has done this and could tell me if this is a one class change or if I will have to make changes in 15 different places, it would be much appreciated. Thanks, Bob James Mitchell wrote: It is only possible if you have the source code ;) -- James Mitchell Software Engineer / Struts Evangelist http://www.struts-atlanta.org 678.910.8017 770.822.3359 AIM:jmitchtx - Original Message - From: Bob Lee [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 2:50 PM Subject: message-resources in Struts 1.0? Is it possible to cleanly patch Struts 1.0 to use a custom message resources factory? Thanks, Bob - 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]
Re: message-resources
Thanks Adam, your comments make sense if I was using Struts1.1, but for reasons out of my control I am using Struts1.0 and the struts-config_1_0.dtd doesnt define nessage-resources tag ... so, I can't use it. But I can use the html:errors property=property bundle=bundle tag, however I can not define a new bundle with some key because of absense of the message-resources in the dtd. Is there another way to define a bundle other than a default one? I feel like a total newbie in this issue. Thanks in advance. Yakov Belov - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: message-resources
Hmmm, yes. Problematic. With 1.0 we used a custom taglib that called the string from the correct bundle using this code: public static String getResource( ServletContext pContext, String pBundle, String pKey) throws Exception { MessageResources lResources = (MessageResources)pContext.getAttribute(pBundle); if (lResources == null) { mLogger.warn(cannot find ' + pBundle + ' in ServletContext); return ; } if (lResources.isPresent(pKey)) // { return lResources.getMessage(pKey); } else { mLogger.warn(cannot find key ' + pKey + ' in bundle ' + pBundle + '); return ; } } HTH, Adam On 08/29/2003 03:51 AM Yakov Belov wrote: Thanks Adam, your comments make sense if I was using Struts1.1, but for reasons out of my control I am using Struts1.0 and the struts-config_1_0.dtd doesnt define nessage-resources tag ... so, I can't use it. But I can use the html:errors property=property bundle=bundle tag, however I can not define a new bundle with some key because of absense of the message-resources in the dtd. Is there another way to define a bundle other than a default one? I feel like a total newbie in this issue. Thanks in advance. Yakov Belov - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: message-resources
On 08/28/2003 07:26 AM Yakov Belov wrote: I am wondering which file to insert message-resources key=key parameter=parameter null=false/ into. Is it struts-config.xml for the application? Yes it is. Except you have no key attribute there. Parameter is the name of the bundle, without the .properties. Also, do I understand correctly?: 1) key is the id for the bundle to be used, say in html:errors When you use the message resources, in java are in jsp, you get the string from your bundle which is identified by this key. You specify the bundle you want in various ways, e.g. in the web.xml when you are using jstl fmt (aka i18n) taglib: context-param param-name javax.servlet.jsp.jstl.fmt.localizationContext /param-name param-valueApplicationResources/param-value /context-param 2) parameter is the actual file name of the bundle - without .properties Yes, in the struts-config declaration 3) the default location for *.properties files app/WEB-INF/classes yes good luck Adam Thank you for your comments, Yakov Belov - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- struts 1.1 + tomcat 4.1.27 + java 1.4.2 Linux 2.4.20 RH9 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Message Resources example using OJB
Check source forge www.sf.net, I think James from this list created one about 6 months ago and he was very happy with the performance of it. -Original Message- From: Srikanth Gubba [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 9:37 AM To: '[EMAIL PROTECTED]' Subject: Message Resources example using OJB Hi all, Has anyone tried and used Message Resources example using OJB which can be used to place the application properties in a database instead of a properties file. If anyone has tried this, can u help me know what to do when a property is changed in the database, at present i am having to reload the application. Is there any way around this so that the application reads the properties dynamically. Thanks in adv, srikanth. - 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]
RE: Message Resources example using OJB
Hi, I am currently using this which is very good, but want to know the ways to avoid relocading the application when a property is changed. Thanks, Srikanth. -Original Message- From: Hookom, Jacob [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 11:25 AM To: 'Struts Users Mailing List' Subject: RE: Message Resources example using OJB Check source forge www.sf.net, I think James from this list created one about 6 months ago and he was very happy with the performance of it. -Original Message- From: Srikanth Gubba [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 9:37 AM To: '[EMAIL PROTECTED]' Subject: Message Resources example using OJB Hi all, Has anyone tried and used Message Resources example using OJB which can be used to place the application properties in a database instead of a properties file. If anyone has tried this, can u help me know what to do when a property is changed in the database, at present i am having to reload the application. Is there any way around this so that the application reads the properties dynamically. Thanks in adv, srikanth. - 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]
Re: Message Resources example using OJB
On Thursday 26 June 2003 11:25, Hookom, Jacob wrote: Check source forge www.sf.net, I think James from this list created one about 6 months ago and he was very happy with the performance of it. That is the one Srikanth is speaking about. We had an off-line discussion about caching, and I just wasn't able to help. I know enough about OJB to get this implementation to work. Deeper configuration is up to the developer. The only thing I can suggest is to change ObjectCacheClass to use org.apache.ojb.broker.cache.ObjectCacheDefaultImpl in your OJB.properties file. Good luck with it. -Original Message- From: Srikanth Gubba [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 9:37 AM To: '[EMAIL PROTECTED]' Subject: Message Resources example using OJB Hi all, Has anyone tried and used Message Resources example using OJB which can be used to place the application properties in a database instead of a properties file. If anyone has tried this, can u help me know what to do when a property is changed in the database, at present i am having to reload the application. Is there any way around this so that the application reads the properties dynamically. Thanks in adv, srikanth. - 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] -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Message Resources example using OJB
On Thursday 26 June 2003 13:30, James Mitchell wrote: On Thursday 26 June 2003 11:25, Hookom, Jacob wrote: Check source forge www.sf.net, I think James from this list created one about 6 months ago and he was very happy with the performance of it. That is the one Srikanth is speaking about. We had an off-line discussion about caching, and I just wasn't able to help. I know enough about OJB to get this implementation to work. Deeper configuration is up to the developer. The only thing I can suggest is to change ObjectCacheClass to use org.apache.ojb.broker.cache.ObjectCacheDefaultImpl in your OJB.properties ...sorry, that was supposed to ObjectCacheEmptyImpl, but now that I think about it, you may need to upgrade OJB to a newer version to get that class. file. Good luck with it. -Original Message- From: Srikanth Gubba [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 9:37 AM To: '[EMAIL PROTECTED]' Subject: Message Resources example using OJB Hi all, Has anyone tried and used Message Resources example using OJB which can be used to place the application properties in a database instead of a properties file. If anyone has tried this, can u help me know what to do when a property is changed in the database, at present i am having to reload the application. Is there any way around this so that the application reads the properties dynamically. Thanks in adv, srikanth. - 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] -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Message Resources example using OJB
ObjectCacheEmptyImpl is not in the older version , so I have updated the OJB binary from their site, but the newer version doesnot have the classes org.apache.ojb.broker.query.QueryByExample;/// (the new one might be QueryByIdentity();// and PersistenceBrokerFactory.createPersistenceBroker(); /// (the new one might be defaultPersistenceBroker();// Even after changing, I could not get them to compile since it is giving me errors incompatible throws list; found: org.apache.ojb.broker.PersistenceBrokerException, required: java.lang.Throwable at line MessageResource m = (MessageResource)broker.getObjectByQuery(qry); i tried but could not figure out what to do.does anyone has any idea what this might be? Thanks, srikanth. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:36 PM To: Struts Users Mailing List Subject: Re: Message Resources example using OJB On Thursday 26 June 2003 13:30, James Mitchell wrote: On Thursday 26 June 2003 11:25, Hookom, Jacob wrote: Check source forge www.sf.net, I think James from this list created one about 6 months ago and he was very happy with the performance of it. That is the one Srikanth is speaking about. We had an off-line discussion about caching, and I just wasn't able to help. I know enough about OJB to get this implementation to work. Deeper configuration is up to the developer. The only thing I can suggest is to change ObjectCacheClass to use org.apache.ojb.broker.cache.ObjectCacheDefaultImpl in your OJB.properties ...sorry, that was supposed to ObjectCacheEmptyImpl, but now that I think about it, you may need to upgrade OJB to a newer version to get that class. file. Good luck with it. -Original Message- From: Srikanth Gubba [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 9:37 AM To: '[EMAIL PROTECTED]' Subject: Message Resources example using OJB Hi all, Has anyone tried and used Message Resources example using OJB which can be used to place the application properties in a database instead of a properties file. If anyone has tried this, can u help me know what to do when a property is changed in the database, at present i am having to reload the application. Is there any way around this so that the application reads the properties dynamically. Thanks in adv, srikanth. - 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] -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - 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]
Re: Message Resources example using OJB
On Thursday 26 June 2003 14:48, Srikanth Gubba wrote: ObjectCacheEmptyImpl is not in the older version , so I have updated the OJB binary from their site, but the newer version doesnot have the classes org.apache.ojb.broker.query.QueryByExample;/// (the new one might be QueryByIdentity();// and PersistenceBrokerFactory.createPersistenceBroker(); /// (the new one might be defaultPersistenceBroker();// Even after changing, I could not get them to compile since it is giving me errors incompatible throws list; found: org.apache.ojb.broker.PersistenceBrokerException, required: java.lang.Throwable at line MessageResource m = (MessageResource)broker.getObjectByQuery(qry); i tried but could not figure out what to do.does anyone has any idea what this might be? Sorry you're having trouble with it. Right now I'm rewriting this extension to use the latest and greates from OJB. I hope to finish by tonight. I'll let you know. Thanks, srikanth. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:36 PM To: Struts Users Mailing List Subject: Re: Message Resources example using OJB On Thursday 26 June 2003 13:30, James Mitchell wrote: On Thursday 26 June 2003 11:25, Hookom, Jacob wrote: Check source forge www.sf.net, I think James from this list created one about 6 months ago and he was very happy with the performance of it. That is the one Srikanth is speaking about. We had an off-line discussion about caching, and I just wasn't able to help. I know enough about OJB to get this implementation to work. Deeper configuration is up to the developer. The only thing I can suggest is to change ObjectCacheClass to use org.apache.ojb.broker.cache.ObjectCacheDefaultImpl in your OJB.properties ...sorry, that was supposed to ObjectCacheEmptyImpl, but now that I think about it, you may need to upgrade OJB to a newer version to get that class. file. Good luck with it. -Original Message- From: Srikanth Gubba [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 9:37 AM To: '[EMAIL PROTECTED]' Subject: Message Resources example using OJB Hi all, Has anyone tried and used Message Resources example using OJB which can be used to place the application properties in a database instead of a properties file. If anyone has tried this, can u help me know what to do when a property is changed in the database, at present i am having to reload the application. Is there any way around this so that the application reads the properties dynamically. Thanks in adv, srikanth. - 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] -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Message Resources example using OJB
Thank you very much. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 3:11 PM To: Struts Users Mailing List Subject: Re: Message Resources example using OJB On Thursday 26 June 2003 14:48, Srikanth Gubba wrote: ObjectCacheEmptyImpl is not in the older version , so I have updated the OJB binary from their site, but the newer version doesnot have the classes org.apache.ojb.broker.query.QueryByExample;/// (the new one might be QueryByIdentity();// and PersistenceBrokerFactory.createPersistenceBroker(); /// (the new one might be defaultPersistenceBroker();// Even after changing, I could not get them to compile since it is giving me errors incompatible throws list; found: org.apache.ojb.broker.PersistenceBrokerException, required: java.lang.Throwable at line MessageResource m = (MessageResource)broker.getObjectByQuery(qry); i tried but could not figure out what to do.does anyone has any idea what this might be? Sorry you're having trouble with it. Right now I'm rewriting this extension to use the latest and greates from OJB. I hope to finish by tonight. I'll let you know. Thanks, srikanth. -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 1:36 PM To: Struts Users Mailing List Subject: Re: Message Resources example using OJB On Thursday 26 June 2003 13:30, James Mitchell wrote: On Thursday 26 June 2003 11:25, Hookom, Jacob wrote: Check source forge www.sf.net, I think James from this list created one about 6 months ago and he was very happy with the performance of it. That is the one Srikanth is speaking about. We had an off-line discussion about caching, and I just wasn't able to help. I know enough about OJB to get this implementation to work. Deeper configuration is up to the developer. The only thing I can suggest is to change ObjectCacheClass to use org.apache.ojb.broker.cache.ObjectCacheDefaultImpl in your OJB.properties ...sorry, that was supposed to ObjectCacheEmptyImpl, but now that I think about it, you may need to upgrade OJB to a newer version to get that class. file. Good luck with it. -Original Message- From: Srikanth Gubba [mailto:[EMAIL PROTECTED] Sent: Thursday, June 26, 2003 9:37 AM To: '[EMAIL PROTECTED]' Subject: Message Resources example using OJB Hi all, Has anyone tried and used Message Resources example using OJB which can be used to place the application properties in a database instead of a properties file. If anyone has tried this, can u help me know what to do when a property is changed in the database, at present i am having to reload the application. Is there any way around this so that the application reads the properties dynamically. Thanks in adv, srikanth. - 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] -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - 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]
Re: Message Resources Problem?
Hi Marc, I have pretty much the same configuration as you do (jboss, struts, jdk1.4.1). I don't know what is causing your exceptions. But I can tell you that I don't suffer the same problem. So my guess is that something is wrong. Sorry, can't help you any further. Cheers, Harm. Marc L. Veary [EMAIL PROTECTED] 06/13/2003 04:49 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To 'Struts Users Mailing List' [EMAIL PROTECTED] cc Subject Message Resources Problem? Hi I have: jakarta-struts-1.1-b3, JBoss 3.2.1, JDK 1.3.1_08 A simple application which uses bean:message key=.../ and everything works, except when a JSP is rendered which contains one or more of the above tag JBoss shows some exceptions: Element type message-resource must be declared and: Element type plug-in must be declared These elements are present in the struts-config.xml, and the message resource is being read, it is just these odd exceptions? Any clues would be gratefully recieved. Kindly, -- Marc (A Newbie to Struts) - 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]
Re: Message Resources Problem?
Marc, are you deploying a .war file or do you use the exploded format? -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, June 13, 2003 10:53 AM Subject: Re: Message Resources Problem? Hi Marc, I have pretty much the same configuration as you do (jboss, struts, jdk1.4.1). I don't know what is causing your exceptions. But I can tell you that I don't suffer the same problem. So my guess is that something is wrong. Sorry, can't help you any further. Cheers, Harm. Marc L. Veary [EMAIL PROTECTED] 06/13/2003 04:49 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To 'Struts Users Mailing List' [EMAIL PROTECTED] cc Subject Message Resources Problem? Hi I have: jakarta-struts-1.1-b3, JBoss 3.2.1, JDK 1.3.1_08 A simple application which uses bean:message key=.../ and everything works, except when a JSP is rendered which contains one or more of the above tag JBoss shows some exceptions: Element type message-resource must be declared and: Element type plug-in must be declared These elements are present in the struts-config.xml, and the message resource is being read, it is just these odd exceptions? Any clues would be gratefully recieved. Kindly, -- Marc (A Newbie to Struts) - 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]
RE: Message Resources Problem?
Hi Harm, I followed the install instructions to the letter as well with the latest versions of the various required libraries (xerces, etc). Here is some more of the stacktrace: 14:33:47,421 ERROR [Digester] Parse Error at line 64 column 66: Element type me ssage-resources must be declared. org.xml.sax.SAXParseException: Element type message-resources must be declared . at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Er rorHandlerWrapper.java:232) at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper. java:173) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter. java:362) at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter. java:296) at org.apache.xerces.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDV alidator.java:2874) at org.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDValidat or.java:814) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElemen t(XMLDocumentFragmentScannerImpl.java:748) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContent Dispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1454) at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XM LDocumentFragmentScannerImpl.java:333) Kind regards, -- Marc - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Message Resources Problem?
I am using ant to automate a WAR contained in an EAR and this is then copied directly to the deploy directory of JBoss. Regards, -- Marc -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: 13 June 2003 16:01 To: Struts Users Mailing List Subject: Re: Message Resources Problem? Marc, are you deploying a .war file or do you use the exploded format? -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, June 13, 2003 10:53 AM Subject: Re: Message Resources Problem? Hi Marc, I have pretty much the same configuration as you do (jboss, struts, jdk1.4.1). I don't know what is causing your exceptions. But I can tell you that I don't suffer the same problem. So my guess is that something is wrong. Sorry, can't help you any further. Cheers, Harm. Marc L. Veary [EMAIL PROTECTED] 06/13/2003 04:49 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To 'Struts Users Mailing List' [EMAIL PROTECTED] cc Subject Message Resources Problem? Hi I have: jakarta-struts-1.1-b3, JBoss 3.2.1, JDK 1.3.1_08 A simple application which uses bean:message key=.../ and everything works, except when a JSP is rendered which contains one or more of the above tag JBoss shows some exceptions: Element type message-resource must be declared and: Element type plug-in must be declared These elements are present in the struts-config.xml, and the message resource is being read, it is just these odd exceptions? Any clues would be gratefully recieved. Kindly, -- Marc (A Newbie to Struts) - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Message Resources Problem?
Ok, first thing I would do is verify that the entry for your struts-config is correct in your web.xml. Next thing I would do is deploy the ear expanded instead of packaged and play around with various settings.such as moving around the elements in the struts-config (in case you've gotten them out of order. Touch the web.xml and JBoss will instantly redploy your app. Verify the struts-config by using the Struts Cosole by James Holmes: http://jamesholmes.com/struts Hope this helps -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - Original Message - From: Marc L. Veary [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, June 13, 2003 11:08 AM Subject: RE: Message Resources Problem? I am using ant to automate a WAR contained in an EAR and this is then copied directly to the deploy directory of JBoss. Regards, -- Marc -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: 13 June 2003 16:01 To: Struts Users Mailing List Subject: Re: Message Resources Problem? Marc, are you deploying a .war file or do you use the exploded format? -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, June 13, 2003 10:53 AM Subject: Re: Message Resources Problem? Hi Marc, I have pretty much the same configuration as you do (jboss, struts, jdk1.4.1). I don't know what is causing your exceptions. But I can tell you that I don't suffer the same problem. So my guess is that something is wrong. Sorry, can't help you any further. Cheers, Harm. Marc L. Veary [EMAIL PROTECTED] 06/13/2003 04:49 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To 'Struts Users Mailing List' [EMAIL PROTECTED] cc Subject Message Resources Problem? Hi I have: jakarta-struts-1.1-b3, JBoss 3.2.1, JDK 1.3.1_08 A simple application which uses bean:message key=.../ and everything works, except when a JSP is rendered which contains one or more of the above tag JBoss shows some exceptions: Element type message-resource must be declared and: Element type plug-in must be declared These elements are present in the struts-config.xml, and the message resource is being read, it is just these odd exceptions? Any clues would be gratefully recieved. Kindly, -- Marc (A Newbie to Struts) - 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] - 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]
RE: Message Resources Problem?
Thanks for the help. I'll go and do this right now, and let you know the results. Cheers m8... Regards, -- Marc -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: 13 June 2003 16:21 To: Struts Users Mailing List Subject: Re: Message Resources Problem? Ok, first thing I would do is verify that the entry for your struts-config is correct in your web.xml. Next thing I would do is deploy the ear expanded instead of packaged and play around with various settings.such as moving around the elements in the struts-config (in case you've gotten them out of order. Touch the web.xml and JBoss will instantly redploy your app. Verify the struts-config by using the Struts Cosole by James Holmes: http://jamesholmes.com/struts Hope this helps -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - Original Message - From: Marc L. Veary [EMAIL PROTECTED] To: 'Struts Users Mailing List' [EMAIL PROTECTED] Sent: Friday, June 13, 2003 11:08 AM Subject: RE: Message Resources Problem? I am using ant to automate a WAR contained in an EAR and this is then copied directly to the deploy directory of JBoss. Regards, -- Marc -Original Message- From: James Mitchell [mailto:[EMAIL PROTECTED] Sent: 13 June 2003 16:01 To: Struts Users Mailing List Subject: Re: Message Resources Problem? Marc, are you deploying a .war file or do you use the exploded format? -- James Mitchell Software Developer/Struts Evangelist http://www.struts-atlanta.org 770-822-3359 AIM:jmitchtx - Original Message - From: [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, June 13, 2003 10:53 AM Subject: Re: Message Resources Problem? Hi Marc, I have pretty much the same configuration as you do (jboss, struts, jdk1.4.1). I don't know what is causing your exceptions. But I can tell you that I don't suffer the same problem. So my guess is that something is wrong. Sorry, can't help you any further. Cheers, Harm. Marc L. Veary [EMAIL PROTECTED] 06/13/2003 04:49 PM Please respond to Struts Users Mailing List [EMAIL PROTECTED] To 'Struts Users Mailing List' [EMAIL PROTECTED] cc Subject Message Resources Problem? Hi I have: jakarta-struts-1.1-b3, JBoss 3.2.1, JDK 1.3.1_08 A simple application which uses bean:message key=.../ and everything works, except when a JSP is rendered which contains one or more of the above tag JBoss shows some exceptions: Element type message-resource must be declared and: Element type plug-in must be declared These elements are present in the struts-config.xml, and the message resource is being read, it is just these odd exceptions? Any clues would be gratefully recieved. Kindly, -- Marc (A Newbie to Struts) - 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] - 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]
Re: Message resources are not loaded until an action is called.
is your ActionServlet load priority set as 1 or maybe 2 to ensure that the servlet is loaded first ? On Tuesday 01 April 2003 2:02 pm, [EMAIL PROTECTED] wrote: I am using struts 1.1rc1 TomCat 3.3. In my struts-config.xml I have the following line; message-resources parameter=messages / I have messages.properties in /WEB-INF/classes. If I call a JSP straight after a Tomcat 3.3 restart, I get javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE However, if I call the underlying action form for the JSP which contains the line; MessageResources resources = (MessageResources) request.getAttribute(Action.MESSAGES_KEY); Then everything is ok. I get the impression this resource should be load at container start-up. They were in 1.0.2 when the resource was supplied as a paramter to the Action servlet. Any ideas what I am doing wrong? T. Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - 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]
RE: Message resources are not loaded until an action is called.
Works now - thanks. -Original Message- From: Stephen Smithstone [mailto:[EMAIL PROTECTED] Sent: 01 April 2003 14:08 To: Struts Users Mailing List Subject: Re: Message resources are not loaded until an action is called. is your ActionServlet load priority set as 1 or maybe 2 to ensure that the servlet is loaded first ? On Tuesday 01 April 2003 2:02 pm, [EMAIL PROTECTED] wrote: I am using struts 1.1rc1 TomCat 3.3. In my struts-config.xml I have the following line; message-resources parameter=messages / I have messages.properties in /WEB-INF/classes. If I call a JSP straight after a Tomcat 3.3 restart, I get javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE However, if I call the underlying action form for the JSP which contains the line; MessageResources resources = (MessageResources) request.getAttribute(Action.MESSAGES_KEY); Then everything is ok. I get the impression this resource should be load at container start-up. They were in 1.0.2 when the resource was supplied as a paramter to the Action servlet. Any ideas what I am doing wrong? T. Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - 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] Visit our website at http://www.ubswarburg.com This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any securities or related financial instruments. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Message resources, as usual
Mmm, sorry, I'd better show you a better stack trace, caught manually in the jsp by me: --- javax.servlet.jsp.JspException: Missing message for key string1 at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:298) at org.apache.jsp.messagestest_jsp._jspx_meth_bean_message_0(messagestest_jsp.j ava:131) at org.apache.jsp.messagestest_jsp._jspService(messagestest_jsp.java:83) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 04) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) ... AND MORE - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Message resources, as usual
Just a quick suggestion, this shouldn't make a difference, but change this: string1 = res1 str1 string2 = res1 str2 to this: string1= res1 str1 string2= res1 str2 Other than that I can't imagine what the problem is. This obviously works in the example app. Good Luck. -- James Mitchell - Original Message - From: Albert Moliner [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, February 14, 2003 7:09 AM Subject: Re: Message resources, as usual Mmm, sorry, I'd better show you a better stack trace, caught manually in the jsp by me: --- javax.servlet.jsp.JspException: Missing message for key string1 at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:298) at org.apache.jsp.messagestest_jsp._jspx_meth_bean_message_0(messagestest_jsp.j ava:131) at org.apache.jsp.messagestest_jsp._jspService(messagestest_jsp.java:83) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 04) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) ... AND MORE - 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]
Re: Message resources, as usual
Hate to be the one to point this out, but they are both the same ;-) - Original Message - From: James Mitchell [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, February 14, 2003 2:54 PM Subject: Re: Message resources, as usual Just a quick suggestion, this shouldn't make a difference, but change this: string1 = res1 str1 string2 = res1 str2 to this: string1= res1 str1 string2= res1 str2 Other than that I can't imagine what the problem is. This obviously works in the example app. Good Luck. -- James Mitchell - Original Message - From: Albert Moliner [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Friday, February 14, 2003 7:09 AM Subject: Re: Message resources, as usual Mmm, sorry, I'd better show you a better stack trace, caught manually in the jsp by me: --- javax.servlet.jsp.JspException: Missing message for key string1 at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:298) at org.apache.jsp.messagestest_jsp._jspx_meth_bean_message_0(messagestest_jsp.j ava:131) at org.apache.jsp.messagestest_jsp._jspService(messagestest_jsp.java:83) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 04) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) ... AND MORE - 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]
Re: Message resources, as usual
Just a quick suggestion, this shouldn't make a difference, but change this: string1 = res1 str1 string2 = res1 str2 to this: string1= res1 str1 string2= res1 str2 As far as I know they are the same, as both halves of the equality are trimmed when parsed, and formerly (when using one single RB) they worked. Anyway, I've tried, and it's still the same. Thank you anyway. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Message resources, as usual
Forgive me for my insisting on the subject. Just to be sure nothing is escaping from my attention, when I try and modify the jsp bean:message tag, telling it to use a non-defined RB (aares1 instead of res1), the exception is -- javax.servlet.jsp.JspException: Cannot find message resources under key aares1 at org.apache.struts.util.RequestUtils.message(RequestUtils.java:939) at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:295) at org.apache.jsp.messagestest_jsp._jspx_meth_bean_message_0(messagestest_jsp.j ava:131) at org.apache.jsp.messagestest_jsp._jspService(messagestest_jsp.java:83) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2 04) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) ...ETCETERA -- This makes me think that originally the resource bundle was really found, as else the exception would be like the one displayed above, and not the Missing message for key string1 that I got. I'll take a look at what the bean:message tag is doing, to see if I get a clue. Albert. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: message-resources
On Fri, 31 Jan 2003, Jay Andrews wrote: Date: Fri, 31 Jan 2003 07:40:25 -0800 (PST) From: Jay Andrews [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: message-resources I've just started to learn struts and I cannot seem to find a good answer to this question. What's the difference between specifying property files in the struts-config.xml file under MESSAGE-RESOURCES and specifying them as an INIT-PARAM of the struts ActionServlet? Using an init parameter is the old way to do it, and remains only for backwards compatibility with Struts 1.0. Using a message-resources element in struts-config.xml is the new way to do it, and is required if you ever want to use the multiple-module support. Thanks! Craig - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: message-resources
This has happened to me before and it's quite frustrating. I believe it's a classpath issue. Make sure none of your classes are on tomcat's runtime classpath. David From: LUCERO,DENNIS (HP-Boise,ex1) [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: ' ([EMAIL PROTECTED])' [EMAIL PROTECTED] Subject: message-resources Date: Thu, 5 Dec 2002 17:35:18 -0500 Hi, I have a jsp with the struts bean taglib defined and the following line : bean:message key=index.title / In struts-config.xml I have the following : message-resources parameter=MyAppResources / And I put MyAppResources.properties in tomcat/webapps/applicationName/WEB-INF/classes when I try and load the page I get the error javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE Any help would be greatly appreciated!!! We come from the land of the ice and snow With the midnight sun, where the hot springs glow The hammer of the gods, will drive our ships to new lands Fight the horde, Sing and cry Valhalla I am coming _ STOP MORE SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Message Resources
Hi David, Is that code slated to be part of Struts or is it published somewhere? ummm...No and Yes My initial implementation of MessageResources is complete and works quite nicely (as a matter of fact). I am in the process of refactoring the code to fit into the resources subproject under commons sandbox. I'm also planning to add support for Torque, simper, custom DAO, whatever. What will probably happen is that there will be a commons DBMessageResources and then a Struts specific DBMessageResources (e.g. Validator), although I don't think the Struts piece will become part of the distribution. At best, I'm guessing it might make it into contrib. It is ready to run, but before downloading and trying this out, you should know that it uses OJB (under the covers) to access the database and pull the resources required for your running app. Don't let that scare you off, because adding/changing the configuration is trivial and anyone can do it. I mention this only because it fits well if you are already using it. I am also working on a management utility that lets you visually maintain the bundle values using your own running app. So where is the code? It lives on my lonely server (at home), but I have plans to move it to sf.net under the struts project. http://www.open-tools.org/struts-atlanta/downloads If the page comes up unavailable, let me know and I'll send it to you via email. It is 3.6 MB and includes the struts-example modified to use this extension. All you need to do is: 1. Run the database script on the database you plan to use. (WARNING - Make sure you understand what you are running) 2. Change the repository.xml with your own connection info (basic datasource stuff) 3. Run ant on the build.xml in the root directory. 4. Deploy the resulting war file James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein (1879-1955) -Original Message- From: David Sent: Friday, November 08, 2002 4:18 PM To: [EMAIL PROTECTED] Subject: Message Resources James, I have a highly configurable application written with Struts and decided it would be best to create a database implementation of message resources. After looking at the PropertyMessageResources and propertyMessageResourcesFactory classes, I thought I had better check to make sure that I wasn't duplicating functionality that already existed. Searching on likely terms I came upon a reference to a DBMessageResources implementation. Is that code slated to be part of Struts or is it published somewhere? Thanks, David Morris -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
RE: Message Resources Problem in SubApp - Bug?
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10868 James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein (1879-1955) -Original Message- From: Dan Tran [mailto:danttran;hotmail.com] Sent: Wednesday, October 30, 2002 4:56 PM To: Struts Users Mailing List Subject: Message Resources Problem in SubApp - Bug? I have two Struts config files: struts-config.xml and struts-config-myapp.xml All of my work is in the second one ( the subapp). What I found out, I have to copy message resources in the subapp to the default (struts-config.xml) as well inorder for struts validator to work. Other wise, it would throw an exception which has something to do with the Message class. Is it the intended behaviour? I am not able to find any reference of the behavior any where, include the archive. Any advice? -- To unsubscribe, e-mail: mailto:struts-user-unsubscribe;jakarta.apache.org For additional commands, e-mail: mailto:struts-user-help;jakarta.apache.org
Re: Message Resources Problem in SubApp - Bug?
Hi James, Just want to report another relate error on this topic. When deploy on JRUN4, and not using struts validator. My static forward action (ie an action with static forward to a jsp) which displays a blank form, can only run once. When I try again, Jrun complains about not able to find resources in my jsp page. Is it a JRun bug? I then copy the message resource to the default app configuration, JRUN 4 is then happy. -Da - Original Message - From: James Mitchell [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Sent: Wednesday, October 30, 2002 2:10 PM Subject: RE: Message Resources Problem in SubApp - Bug? http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10868 James Mitchell Software Engineer/Struts Evangelist http://www.open-tools.org Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein (1879-1955) -Original Message- From: Dan Tran [mailto:danttran;hotmail.com] Sent: Wednesday, October 30, 2002 4:56 PM To: Struts Users Mailing List Subject: Message Resources Problem in SubApp - Bug? I have two Struts config files: struts-config.xml and struts-config-myapp.xml All of my work is in the second one ( the subapp). What I found out, I have to copy message resources in the subapp to the default (struts-config.xml) as well inorder for struts validator to work. Other wise, it would throw an exception which has something to do with the Message class. Is it the intended behaviour? I am not able to find any reference of the behavior any where, include the archive. Any advice? -- 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
Re: Message Resources Placement
speculation reason=I haven't used eclipse w/ sysdeo plugin I suspect the problem is that the plugin adds struts.jar to the system (ie. tomcat's) classpath. So, all Struts' classes don't see WEB-INF/classes. /speculation At 06:05 am 26-08-2002, you wrote: I think I've solved it!!! Short story: add your /classes folder to tomcat's classpath. Long story below (gurus please see questions at bottom): I'm using struts 1.0.2, tomcat 4.0.4, and eclipse with the sysdeo tomcat plugin as a development environment. The way struts finds/loads the messages file is by using the classloader and the getResourceAsStream() method. That means the messages file must be on the runtime classpath for the classloader to be able to see it. Now, I had some struts projects that worked and some new ones that couldn't use the bean:message tag without throwing the error I described previously. All I did was (through eclipse) add my new project to tomcat's classpath. I'm not sure what the plugin does behind the scenes but I imagine it starts tomcat with something like: java tomcat -cp /myapp/classes Can someone confirm that this is what is going on? When I deploy my app outside of my development environment will I need to start tomcat with this type of statement? I assumed webapps were automatically on the containers runtime classpath, is that wrong? Dave Hi. I'm having the exact same problem, so I can't help you. But I am interested in the solution! If you solve it, please let me know. Here's my previous (unanswered) post, in case you're interested: I'm using v. 1.02 and Sun J2EE SDK 1.3.1 (Tomcat) and have been trying to get Struts to start up without much luck because of ApplicationResources.properties. Currently, I have extended ActionServlet to spy on what init() is doing, and I see the log message: Loading application resources from resource ApplicationResources.properties Looks good! The file is in the same directory as the new servlet (/WEB-INF/classes) so it can't be a path problem. However, my first action (init.do) simply loads a JSP that includes the code: logic:notPresent name=org.apache.struts.action.MESSAGE scope=application font color=red ERROR: Application resources not loaded -- check servlet container logs for error messages. /font /logic:notPresent Which does its job and displays this error message. Why? I even tried: % out.println(config file = + config.getInitParameter(application)); % and it printed config file = null. Also, if I try to display a message then it gives a message with key XXX not found, as I would expect, given the above behavior. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] -- John Yu Scioworks Technologies e: [EMAIL PROTECTED] w: +(65) 873 5989 w: http://www.scioworks.com m: +(65) 9782 9610 Scioworks Camino - Don't develop Struts Apps without it!
Re: Message Resources Placement
Hi. I'm having the exact same problem, so I can't help you. But I am interested in the solution! If you solve it, please let me know. Here's my previous (unanswered) post, in case you're interested: I'm using v. 1.02 and Sun J2EE SDK 1.3.1 (Tomcat) and have been trying to get Struts to start up without much luck because of ApplicationResources.properties. Currently, I have extended ActionServlet to spy on what init() is doing, and I see the log message: Loading application resources from resource ApplicationResources.properties Looks good! The file is in the same directory as the new servlet (/WEB-INF/classes) so it can't be a path problem. However, my first action (init.do) simply loads a JSP that includes the code: logic:notPresent name=org.apache.struts.action.MESSAGE scope=application font color=red ERROR: Application resources not loaded -- check servlet container logs for error messages. /font /logic:notPresent Which does its job and displays this error message. Why? I even tried: % out.println(config file = + config.getInitParameter(application)); % and it printed config file = null. Also, if I try to display a message then it gives a message with key XXX not found, as I would expect, given the above behavior. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Message Resources Placement
I think I've solved it!!! Short story: add your /classes folder to tomcat's classpath. Long story below (gurus please see questions at bottom): I'm using struts 1.0.2, tomcat 4.0.4, and eclipse with the sysdeo tomcat plugin as a development environment. The way struts finds/loads the messages file is by using the classloader and the getResourceAsStream() method. That means the messages file must be on the runtime classpath for the classloader to be able to see it. Now, I had some struts projects that worked and some new ones that couldn't use the bean:message tag without throwing the error I described previously. All I did was (through eclipse) add my new project to tomcat's classpath. I'm not sure what the plugin does behind the scenes but I imagine it starts tomcat with something like: java tomcat -cp /myapp/classes Can someone confirm that this is what is going on? When I deploy my app outside of my development environment will I need to start tomcat with this type of statement? I assumed webapps were automatically on the containers runtime classpath, is that wrong? Dave Hi. I'm having the exact same problem, so I can't help you. But I am interested in the solution! If you solve it, please let me know. Here's my previous (unanswered) post, in case you're interested: I'm using v. 1.02 and Sun J2EE SDK 1.3.1 (Tomcat) and have been trying to get Struts to start up without much luck because of ApplicationResources.properties. Currently, I have extended ActionServlet to spy on what init() is doing, and I see the log message: Loading application resources from resource ApplicationResources.properties Looks good! The file is in the same directory as the new servlet (/WEB-INF/classes) so it can't be a path problem. However, my first action (init.do) simply loads a JSP that includes the code: logic:notPresent name=org.apache.struts.action.MESSAGE scope=application font color=red ERROR: Application resources not loaded -- check servlet container logs for error messages. /font /logic:notPresent Which does its job and displays this error message. Why? I even tried: % out.println(config file = + config.getInitParameter(application)); % and it printed config file = null. Also, if I try to display a message then it gives a message with key XXX not found, as I would expect, given the above behavior. -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED] _ Chat with friends online, try MSN Messenger: http://messenger.msn.com -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: message-resources/ is not working under sub-module for 1.1b2
On Thu, 15 Aug 2002, Trieu, Danny wrote: Date: Thu, 15 Aug 2002 12:47:46 -0700 From: Trieu, Danny [EMAIL PROTECTED] Reply-To: Struts Users Mailing List [EMAIL PROTECTED] To: Struts Users Mailing List [EMAIL PROTECTED] Subject: message-resources/ is not working under sub-module for 1.1b2 Does anyone have any idea why my message-resources/ setting in my config.xml sub-module is not working? I tried with the lastest build and it still not working at all... Thanks, Danny Does the Struts example app work in your environment? It uses a message-resources element for it's application resources. Craig -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
Re: Message Resources question
Hi, maybe you can set your key in the action that calls your JSP, MessageResources msgres = getMessageResources(); String key = msgres.getMessage(article.getChannel()); session.setAttribute(key,key); //or request JSP : String key = (String) session.getAttribute(key); bean:message key='banneradtag' arg0='%=key % / Greetings / Saludos Enrique Almonte DATAPRO Inc. - Original Message - From: Juan Alvarado [EMAIL PROTECTED] To: Struts [EMAIL PROTECTED] Sent: Monday, April 15, 2002 11:48 AM Subject: Message Resources question Hi I need to be able to accomplish the following: bean:message key='banneradtag' arg0='???' / The part above with the ??? needs to be retrieved also from my message resources. So what I need to do is something like: bean:message key='banneradtag' arg0='bean:message key='%=article.getChannel()%'/' / The key is retrieved from a property in a bean thus: %=article.getChannel()% Can anyone tell me if there's a way to accomplish the above. Thanks in advance ** Juan Alvarado Internet Developer -- Manduca Management (786)552-0504 [EMAIL PROTECTED] AOL Instant Messenger: [EMAIL PROTECTED] -- 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]
RE: Message resources
It's looking for ApplicationResources.properties in your WEB-INF/classes directory -Original Message- From: Justin Piper [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 10:43 AM To: Struts Users Mailing List Subject: Message resources I'm sure I'm missing something obvious, but after a day of trying to solve this, I'm quite tired of beating my head against the wall. For some reason it seems that ActionServlet isn't able to load the message resources for my application. I have the following lines in my web.xml file: servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param !-- Irrelevant lines snipped -- load-on-startup2/load-on-startup /servlet In the /WEB-INF/classes directory, I have a file named ApplicationResources.properties, containing the following lines: index.title=Index error.login.username.required=Username is required error.login.password.required=Password is required error.login.incorrect=Invalid username/password pair; please try again If I include 'bean:message key=index.title/' in index.jsp and open it in a web browser, I get a ServletException, Missing message for key index.title. I added some debugging code to index.jsp; % String name = ApplicationResources.properties; java.net.URL url = null; url = this.getClass().getClassLoader().getResource(name); out.println(codeurl/code is null: + (new Boolean(url == null)).toString() + br); % logic:present name=org.apache.struts.action.MESSAGE scope=application Application resources loaded. /logic:present logic:notPresent name=org.apache.struts.action.MESSAGE scope=application Application resources not loaded. /logic:notPresent which produces: url is null:true Application resources loaded. The struts-example application functions properly, as do my ActionServlets (though html:errors/ always returns an empty string, even if my ActionForm returns validation errors). I am at a loss to explain this odd behavior, and would appreciate any insight you could provide. -- Picture the sun as the origin of two intersecting 6-dimensional hyperplanes from which we can deduce a certain transformational sequence which gives us the terminal velocity of a rubber duck ... -- 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]
RE: Message resources
...try adding a property value to your html:errors property=whatever -Original Message- From: Justin Piper [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 10:43 AM To: Struts Users Mailing List Subject: Message resources I'm sure I'm missing something obvious, but after a day of trying to solve this, I'm quite tired of beating my head against the wall. For some reason it seems that ActionServlet isn't able to load the message resources for my application. I have the following lines in my web.xml file: servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param !-- Irrelevant lines snipped -- load-on-startup2/load-on-startup /servlet In the /WEB-INF/classes directory, I have a file named ApplicationResources.properties, containing the following lines: index.title=Index error.login.username.required=Username is required error.login.password.required=Password is required error.login.incorrect=Invalid username/password pair; please try again If I include 'bean:message key=index.title/' in index.jsp and open it in a web browser, I get a ServletException, Missing message for key index.title. I added some debugging code to index.jsp; % String name = ApplicationResources.properties; java.net.URL url = null; url = this.getClass().getClassLoader().getResource(name); out.println(codeurl/code is null: + (new Boolean(url == null)).toString() + br); % logic:present name=org.apache.struts.action.MESSAGE scope=application Application resources loaded. /logic:present logic:notPresent name=org.apache.struts.action.MESSAGE scope=application Application resources not loaded. /logic:notPresent which produces: url is null:true Application resources loaded. The struts-example application functions properly, as do my ActionServlets (though html:errors/ always returns an empty string, even if my ActionForm returns validation errors). I am at a loss to explain this odd behavior, and would appreciate any insight you could provide. -- Picture the sun as the origin of two intersecting 6-dimensional hyperplanes from which we can deduce a certain transformational sequence which gives us the terminal velocity of a rubber duck ... -- 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]
RE: Message resources
Sorry, I should have included that. I'm using Tomcat 4.0. I have log4j.jar, poolman.jar, and struts.jar in my application's /WEB-INF/lib, and jasper-runtime.jar and naming-factory.jar in $TOMCAT_HOME/lib. -Original Message- From: Drozdowski, Terry [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 10:57 AM To: 'Struts Users Mailing List' Subject: RE: Message resources What servlet container are you using? -- Terry Drozdowski Staff, Technology Services SIM Technology - Phoenix Charles Schwab Co. (602)355-8843 Warning: All e-mail sent to this address will be received by the Charles Schwab Corporate e-mail system and is subject to archival and review by someone other than the recipient. -Original Message- From: Justin Piper [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 9:43 AM To: Struts Users Mailing List Subject: Message resources I'm sure I'm missing something obvious, but after a day of trying to solve this, I'm quite tired of beating my head against the wall. For some reason it seems that ActionServlet isn't able to load the message resources for my application. I have the following lines in my web.xml file: servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param !-- Irrelevant lines snipped -- load-on-startup2/load-on-startup /servlet In the /WEB-INF/classes directory, I have a file named ApplicationResources.properties, containing the following lines: index.title=Index error.login.username.required=Username is required error.login.password.required=Password is required error.login.incorrect=Invalid username/password pair; please try again If I include 'bean:message key=index.title/' in index.jsp and open it in a web browser, I get a ServletException, Missing message for key index.title. I added some debugging code to index.jsp; % String name = ApplicationResources.properties; java.net.URL url = null; url = this.getClass().getClassLoader().getResource(name); out.println(codeurl/code is null: + (new Boolean(url == null)).toString() + br); % logic:present name=org.apache.struts.action.MESSAGE scope=application Application resources loaded. /logic:present logic:notPresent name=org.apache.struts.action.MESSAGE scope=application Application resources not loaded. /logic:notPresent which produces: url is null:true Application resources loaded. The struts-example application functions properly, as do my ActionServlets (though html:errors/ always returns an empty string, even if my ActionForm returns validation errors). I am at a loss to explain this odd behavior, and would appreciate any insight you could provide. -- Picture the sun as the origin of two intersecting 6-dimensional hyperplanes from which we can deduce a certain transformational sequence which gives us the terminal velocity of a rubber duck ... -- 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] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Message resources
I tried adding errors.header=font color=red errors.footer=/font to ApplicationResources.properties, and html:errors property=error.login.password.required/ html:errors property=password/ to login.jsp. I wasn't sure whether the property attribute referred to a key in the message resources or to the name of a form element (I suspect the latter), so I included both. Both returned an empty string when I attempted to submit the form without filling out the password form element. -Original Message- From: Fletcher, Ken [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 10:52 AM To: 'Struts Users Mailing List' Subject: RE: Message resources ...try adding a property value to your html:errors property=whatever -Original Message- From: Justin Piper [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 10:43 AM To: Struts Users Mailing List Subject: Message resources I'm sure I'm missing something obvious, but after a day of trying to solve this, I'm quite tired of beating my head against the wall. For some reason it seems that ActionServlet isn't able to load the message resources for my application. I have the following lines in my web.xml file: servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param !-- Irrelevant lines snipped -- load-on-startup2/load-on-startup /servlet In the /WEB-INF/classes directory, I have a file named ApplicationResources.properties, containing the following lines: index.title=Index error.login.username.required=Username is required error.login.password.required=Password is required error.login.incorrect=Invalid username/password pair; please try again If I include 'bean:message key=index.title/' in index.jsp and open it in a web browser, I get a ServletException, Missing message for key index.title. I added some debugging code to index.jsp; % String name = ApplicationResources.properties; java.net.URL url = null; url = this.getClass().getClassLoader().getResource(name); out.println(codeurl/code is null: + (new Boolean(url == null)).toString() + br); % logic:present name=org.apache.struts.action.MESSAGE scope=application Application resources loaded. /logic:present logic:notPresent name=org.apache.struts.action.MESSAGE scope=application Application resources not loaded. /logic:notPresent which produces: url is null:true Application resources loaded. The struts-example application functions properly, as do my ActionServlets (though html:errors/ always returns an empty string, even if my ActionForm returns validation errors). I am at a loss to explain this odd behavior, and would appreciate any insight you could provide. -- Picture the sun as the origin of two intersecting 6-dimensional hyperplanes from which we can deduce a certain transformational sequence which gives us the terminal velocity of a rubber duck ... -- 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] -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
RE: Message resources
The property element in html:errors refers to the error you return from a form's validate method (you can also do this from an Action class, but you have to add something extra) the action mapping section of struts-config.xml file: . action-mappings action path=/login type=action.LoginAction name=loginForm scope=request input=/jsp/userLogin.jsp forward name=notFound path=/jsp/userLogin.jsp/ /action ... ...in the form's validate method: if (loginUserID == null || loginUserID.equals()){ ActionErrors errors = new ActionErrors(); errors.add(loginUserID, new ActionError(userID.required)); return errors;} ...the entry in the resource properties file: userID.required=You did not enter your user ID ...the jsp would look for the property=loginUserID: html:errors property=loginUserID/ If you do this in your Action class, be sure to add the ActionErrors object to the request (the something extra mentioned above) before returning: ... ActionErrors errors = new ActionErrors(); errors.add(userNotFound, new ActionError(user.notInSystem)); request.setAttribute(org.apache.struts.action.ERROR, errors); return mapping.findForward(notFound);} .your resources file would have an entry like this: user.notInSystem=Could not find your user ID in the System .the jsp looks for an error with the property=userNotFound... html:errors property=userNotFound/ The errors.header and errors.footer are automatically added (I don't use them, though). I'm not sure if this will help you (hope it does) -Original Message- From: Justin Piper [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 11:10 AM To: 'Struts Users Mailing List' Subject: RE: Message resources I tried adding errors.header=font color=red errors.footer=/font to ApplicationResources.properties, and html:errors property=error.login.password.required/ html:errors property=password/ to login.jsp. I wasn't sure whether the property attribute referred to a key in the message resources or to the name of a form element (I suspect the latter), so I included both. Both returned an empty string when I attempted to submit the form without filling out the password form element. -Original Message- From: Fletcher, Ken [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 10:52 AM To: 'Struts Users Mailing List' Subject: RE: Message resources ...try adding a property value to your html:errors property=whatever -Original Message- From: Justin Piper [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 10:43 AM To: Struts Users Mailing List Subject: Message resources I'm sure I'm missing something obvious, but after a day of trying to solve this, I'm quite tired of beating my head against the wall. For some reason it seems that ActionServlet isn't able to load the message resources for my application. I have the following lines in my web.xml file: servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param !-- Irrelevant lines snipped -- load-on-startup2/load-on-startup /servlet In the /WEB-INF/classes directory, I have a file named ApplicationResources.properties, containing the following lines: index.title=Index error.login.username.required=Username is required error.login.password.required=Password is required error.login.incorrect=Invalid username/password pair; please try again If I include 'bean:message key=index.title/' in index.jsp and open it in a web browser, I get a ServletException, Missing message for key index.title. I added some debugging code to index.jsp; % String name = ApplicationResources.properties; java.net.URL url = null; url = this.getClass().getClassLoader().getResource(name); out.println(codeurl/code is null: + (new Boolean(url == null)).toString() + br); % logic:present name=org.apache.struts.action.MESSAGE scope=application Application resources loaded. /logic:present logic:notPresent name=org.apache.struts.action.MESSAGE scope=application Application resources not loaded. /logic:notPresent which produces: url is null:true Application resources loaded. The struts-example application functions properly, as do my ActionServlets (though html:errors/ always returns an empty string, even if my ActionForm returns validation errors). I am at a loss to explain this odd behavior, and would appreciate any insight you could provide. -- Picture the sun as the origin of two intersecting 6-dimensional hyperplanes from which we can deduce a certain transformational sequence which gives us the terminal velocity of a rubber duck ... -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED
RE: Message resources
Thanks for your help. I've (finally) tracked down the source of my problem, and, as I originally predicted, I'd missed something very obvious. Instead of naming my file ApplicationResources.properties as I should have, I had named it ApplicationResources.Properties. Now the question is whether I would have ever found my mistake if I hadn't publicly humiliated myself first. :) -Original Message- From: Fletcher, Ken [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 12:15 PM To: 'Struts Users Mailing List' Subject: RE: Message resources The property element in html:errors refers to the error you return from a form's validate method (you can also do this from an Action class, but you have to add something extra) the action mapping section of struts-config.xml file: . action-mappings action path=/login type=action.LoginAction name=loginForm scope=request input=/jsp/userLogin.jsp forward name=notFound path=/jsp/userLogin.jsp/ /action ... ...in the form's validate method: if (loginUserID == null || loginUserID.equals()){ ActionErrors errors = new ActionErrors(); errors.add(loginUserID, new ActionError(userID.required)); return errors;} ...the entry in the resource properties file: userID.required=You did not enter your user ID ...the jsp would look for the property=loginUserID: html:errors property=loginUserID/ If you do this in your Action class, be sure to add the ActionErrors object to the request (the something extra mentioned above) before returning: ... ActionErrors errors = new ActionErrors(); errors.add(userNotFound, new ActionError(user.notInSystem)); request.setAttribute(org.apache.struts.action.ERROR, errors); return mapping.findForward(notFound);} .your resources file would have an entry like this: user.notInSystem=Could not find your user ID in the System .the jsp looks for an error with the property=userNotFound... html:errors property=userNotFound/ The errors.header and errors.footer are automatically added (I don't use them, though). I'm not sure if this will help you (hope it does) -Original Message- From: Justin Piper [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 11:10 AM To: 'Struts Users Mailing List' Subject: RE: Message resources I tried adding errors.header=font color=red errors.footer=/font to ApplicationResources.properties, and html:errors property=error.login.password.required/ html:errors property=password/ to login.jsp. I wasn't sure whether the property attribute referred to a key in the message resources or to the name of a form element (I suspect the latter), so I included both. Both returned an empty string when I attempted to submit the form without filling out the password form element. -Original Message- From: Fletcher, Ken [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 10:52 AM To: 'Struts Users Mailing List' Subject: RE: Message resources ...try adding a property value to your html:errors property=whatever -Original Message- From: Justin Piper [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 01, 2001 10:43 AM To: Struts Users Mailing List Subject: Message resources I'm sure I'm missing something obvious, but after a day of trying to solve this, I'm quite tired of beating my head against the wall. For some reason it seems that ActionServlet isn't able to load the message resources for my application. I have the following lines in my web.xml file: servlet servlet-nameaction/servlet-name servlet-classorg.apache.struts.action.ActionServlet/servlet-class init-param param-nameapplication/param-name param-valueApplicationResources/param-value /init-param !-- Irrelevant lines snipped -- load-on-startup2/load-on-startup /servlet In the /WEB-INF/classes directory, I have a file named ApplicationResources.properties, containing the following lines: index.title=Index error.login.username.required=Username is required error.login.password.required=Password is required error.login.incorrect=Invalid username/password pair; please try again If I include 'bean:message key=index.title/' in index.jsp and open it in a web browser, I get a ServletException, Missing message for key index.title. I added some debugging code to index.jsp; % String name = ApplicationResources.properties; java.net.URL url = null; url = this.getClass().getClassLoader().getResource(name); out.println(codeurl/code is null: + (new Boolean(url == null)).toString() + br); % logic:present name=org.apache.struts.action.MESSAGE scope=application Application resources loaded. /logic:present logic:notPresent name=org.apache.struts.action.MESSAGE scope=application Application resources not loaded. /logic:notPresent which produces: url is null:true