RE: concatenating resources files - in which class?
I wouldn't put them anywhere in your code - I'd use some kind of deployment script to concatenate them and copy them to the appropriate directory. Niall -Original Message-From: Jonathan [mailto:[EMAIL PROTECTED]]Sent: 27 June 2001 16:57To: [EMAIL PROTECTED]Subject: concatenating resources files - in which class? Anyone have any suggestions as to where in the code I should concatenate my multiple resource files? I actually would like the resource files to be in the same directoryas the templates to which they pertain (ie in with the jsp files). Assuming I put my jsp's in WEB-INF/pages, I guess I would have to put the WEB-INF in the classpath as well so that the properties files are visible to the ActionServlet.
Re: concatenating resources files - in which class?
The safest thing is to have them under WEB-INF/classes, which is already on the classpath. I agree that keeping like resources together is good idea, but are they only used by the templates? Do not the Action classes also use these for messages. The JSP's under /WEB-INF/pages are really source code files, and if you precompiled them that folder might be omitted. So personally I would suggest not putting runtime resources in that branch, unless the multiple resources files are moved to another location as part of the concaternation process. (Are you doing this with Ant?) -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/struts/ Jonathan wrote: Anyone have any suggestions as to where in the code I should concatenate my multiple resource files? I actually would like the resource files to be in the same directory as the templates to which they pertain (ie in with the jsp files). Assuming I put my jsp's in WEB-INF/pages, I guess I would have to put the WEB-INF in the classpath as well so that the properties files are visible to the ActionServlet.
RE: concatenating resources files - in which class?
You could also avoid merging them by having multiple resources loaded into the app. This is not directly supported by Struts though. The way we have done this in our project is by extending the ActionServlet and having it load multiple resources in the same way the application resources are loaded (in initApplication). All these resources are then placed in the application context (servlet context). Then you can use the parameter 'bundle' of the message tag to select which message resources to use. If you follow this route I suggest you don't create a message resource for each JSP, especially if you have many of them, but rather for each logical grouping of JSP. Fr. -Original Message- From: Niall Pemberton [mailto:[EMAIL PROTECTED]] Sent: 28 June 2001 13:08 To: [EMAIL PROTECTED]; Jonathan Subject: RE: concatenating resources files - in which class? I wouldn't put them anywhere in your code - I'd use some kind of deployment script to concatenate them and copy them to the appropriate directory. Niall -Original Message- From: Jonathan [mailto:[EMAIL PROTECTED]] Sent: 27 June 2001 16:57 To: [EMAIL PROTECTED] Subject: concatenating resources files - in which class? Anyone have any suggestions as to where in the code I should concatenate my multiple resource files? I actually would like the resource files to be in the same directory as the templates to which they pertain (ie in with the jsp files). Assuming I put my jsp's in WEB-INF/pages, I guess I would have to put the WEB-INF in the classpath as well so that the properties files are visible to the ActionServlet. The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com ***
Re: concatenating resources files - in which class?
I think I will do the following: 1) Identify which Locals I am supporting and declare them within web.xml fr_FR.properties es_ES.properties es_EN.properties en_EN.properties 2) On loading the servlet, for each Local I will search for .properties files and create a FileInputStream for each 3) I will create a target file called Resources_xx_xx.properties and read each file in to it, repeating this for each Local until I have one master properties file for each local Resources_fr_FR.properties Resources_es_ES.properties Resources_es_EN.properties Resources_en_EN.properties Thats it! - Original Message - From: Ted Husted [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, June 28, 2001 7:26 AM Subject: Re: concatenating resources files - in which class? The safest thing is to have them under WEB-INF/classes, which is already on the classpath. I agree that keeping like resources together is good idea, but are they only used by the templates? Do not the Action classes also use these for messages. The JSP's under /WEB-INF/pages are really source code files, and if you precompiled them that folder might be omitted. So personally I would suggest not putting runtime resources in that branch, unless the multiple resources files are moved to another location as part of the concaternation process. (Are you doing this with Ant?) -- Ted Husted, Husted dot Com, Fairport NY USA. -- Custom Software ~ Technical Services. -- Tel 716 737-3463. -- http://www.husted.com/about/struts/ Jonathan wrote: Anyone have any suggestions as to where in the code I should concatenate my multiple resource files? I actually would like the resource files to be in the same directory as the templates to which they pertain (ie in with the jsp files). Assuming I put my jsp's in WEB-INF/pages, I guess I would have to put the WEB-INF in the classpath as well so that the properties files are visible to the ActionServlet.