Re: how to handle refresh button ?
Hello! I think you should use redirect attribute of your action mapping. you should read the thread begun by : From: "Antony Paul" <[EMAIL PROTECTED]> To: "struts" <[EMAIL PROTECTED]> Sent: Monday, December 01, 2003 1:28 PM Subject: forward vs redirect ? - Hope it helps. Caroline > hi, > > I am adding a blank row in my jsp page by pressing the button and submitting > to the same page. The problem is that when user presses the referesh button, > It should not add a row. Is there any standard way of handling this problem > ? > > TIA > Ashwani Kalra > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
dynamic number of lines - Indexed properties ?
Hello! up to now I had used quite "simple" forms... and now I need some more complicated fields, and don't know where to start from Here is what I want to do, with a simple example: I want to describe a family, with all its members: - to describe the family common properties: Last name: _ Address: ___ - to describe a member: (corresponding to an object FamilyMember having name and age properties, getters and setters) Name: _ Age: __ But i don't want to decide of the max number of the family. I see 2 options: * at first, display just one member's description fields. the user clicks on a button in order display a second member's description fields. (in javascript, it would be quicker, but it will work only if the actionform needn't be changed) * have the two description fields and some kind of multiple select in which th description values are put using a button (like the swap tag of struts layout, but with no select on the left). is it feasible with indexed properties (this model would be great, bu i don't what view to use to populate it :-( ) I hope what i need is clear ;-). Ask me if something is not. Thanks Caroline
Re: forward vs redirect ?
Thank you very much Hubert! and Thank you Claire! it indeed works the way you describe it. I suppose redirect="true" works only with /sthg.do or sthg.jsp, and not with a tile definition, isn't it? So, to solve my problem, I should use a /mytiledefinition.do (being a forward action), like this : Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: forward vs redirect ?
hum... tings are not exactly like I described them, but i thought it was the same *.jsp are tiles tiles definitions names, not resources. does it matter. the URL shown is the action path. Caroline > caroline, > > when the user gets to page2, what is the url displayed in the address box? > is it the action or the jsp page? > > > claire > > - Original Message - > From: "Caroline Lauferon" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Monday, December 01, 2003 4:04 PM > Subject: Re: forward vs redirect ? > > > > > For example, say i had an action which saved some details from a form to > a > > > database. if the page is not redirected then if the user were to refresh > > the > > > page, the action would be called again and the data saved again. This > > > obviously i would not want the user to do so in this case i redirect the > > > page, so that if the user were to refresh the page, the save action > would > > > not be called again. > > > > I'm not sure I understand what you mean. The case you describe is very > close > > to mine, and so I would like to prevent the user from making twice the > > addition on refresh: > > I've got one first form, Form1, which calls Action1: > > scope="session" > > input="/form1.jsp"> > > > > > > > > but once the user is on page2, if he makes a refresh, action1 is called > > again and the data added by action1 is added once more > > > > What didn't I understand? > > Thanks > > Caroline > > > > > > - > > 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: forward vs redirect ?
> For example, say i had an action which saved some details from a form to a > database. if the page is not redirected then if the user were to refresh the > page, the action would be called again and the data saved again. This > obviously i would not want the user to do so in this case i redirect the > page, so that if the user were to refresh the page, the save action would > not be called again. I'm not sure I understand what you mean. The case you describe is very close to mine, and so I would like to prevent the user from making twice the addition on refresh: I've got one first form, Form1, which calls Action1: but once the user is on page2, if he makes a refresh, action1 is called again and the data added by action1 is added once more What didn't I understand? Thanks Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: chained actions
Wahouh! thanks a lot for your great explanation! thanks to all those who have also helped me: Adam Hardy and Nicolas De Loof ;-) Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: chained actions
> Is it a multipart form (file upload)? yes. and since you asked me, I just changed it. and now it works??? (but the reset method is called between the two action in both cases). I don't need this encoding, but I wanted to always use the same skeleton, that's why i used it. can you explain me what has been happening? Caroline, puzzled - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: chained actions
> My guess it that the parameters in question are being set in the first > action and there isnt actually a corresponding parameter value in the > request and they are then cleared by reset() prior toi hitting action 2. Is > this the case Caroline? I'm not sure I understand what you mean do you mean the form fields by parameters? If so, that's not what i am doing. My form has several submission buttons. Action1 is just logging the field values and forwarding to the action corresponding to the button used to submit. No modification is made. i found in the archives: "when the second action is being invoked, the form is being 'repopulated' with the initial form values that the form had when it was passed to the first action ". and that's not what is happening :-( Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
chained actions
I don't understand what is happening: I am chaining to Actions that use the same form input. when i submit the form, Action1 is called, and the form parameter is well populated. at the end of action1, I make a forward to Action2. and in Action2, the form is emptied!!??? I don't understand what is happening, and why. the solution I have found is not to specify a form bean for action2 and get it by request.getAttribute("MyForm"). i t works, but I would like to understand why struts creates a new form bean, overriding the existing one. I hope someone will explain me. Caroline PS: here is a snippet of struts-config.xml, Action1.java and Action2.java > /// Action1 MyForm f = (MyForm ) a_form; s_logger.info("f.getField1() : "+ f.getField1()); // outputs a value /// Action2 MyForm f = (MyForm ) a_form; s_logger.info("f.getField1() : "+ f.getField1()); // outputs null - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: ActionErrors problem...
I've just made a little test writing DUMMY: key: Value: expected: in an html document.. and i got DUMMY: key: Value: expected: the problem is that < is a special html symbol explorer thinks its an unknown tag and outputs nothing. if you look in the HTML source of your document, i think you'll see what you were expecting. to output < , use < hope it helps Caroline ---- ---- Caroline LAUFERON Cap Gemini Telecom Media & Networks France Skill Center VASN - RENNES 02 99 27 61 92 [EMAIL PROTECTED] - Original Message - From: "Dominique de Waleffe" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, November 18, 2003 1:29 PM Subject: ActionErrors problem... I have this in my code: errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("error.key.invalid-value.dummy","","",""); I have this in application.properties: error.key.invalid-value.dummy=DUMMY: key:{0} Value:{1} expected:{2} However, using in my page, the only thing that gets displayed is: DUMMY: key: Value: expected: i.e. the replacement values I give are swallowed. Any idea on what I am doing wrong? I tried calling new ActionError(..,a) where a is an Object[] with the values I want. This did not work either. I imagine I must be missing something obvious... Thanks for any hint... D. -- Dominique de Waleffe Email: [EMAIL PROTECTED] [No HTML please] Mission Critical, Drève Richelle 161 Bât N, B-1410 Waterloo, Belgium Phone: +32 2 757 10 15 Fax: +32 2 759 27 60 - 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: No input attribute for mapping path
The likely reason is that you are using validation, but you havn't specified the page to go to if validation fails. You should specify this with "input" attribute of the action that needs validation. Caro - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Show validation error messages next to the corresponding input fields
use "property" attribute of html:messages or html:errors. you will get only the messages that concern your field. Caroline ---- Caroline LAUFERON Cap Gemini Telecom Media & Networks France Skill Center VASN - RENNES 02 99 27 61 92 [EMAIL PROTECTED] - Original Message - From: "Kevin Wang" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, November 13, 2003 3:22 AM Subject: Show validation error messages next to the corresponding input fields > > > > > Does anybody know how to do this? I know I can get ActionErrors which is an > array of messages.. but is there a way I can put the messages in place with > their input fields? > > Thanks. > > > > > - > 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: ResourceBundle not available in ActionForm
I think you can't but i think the error appears on display, doesn't it? Caroline > Hi Caroline, > > thanks. But how can i specify what bundle to use in the ActionForm class? > > > if( ( null == this.accountname ) || ( 1 > this.accountname.length() ) ) > errors.add( "accountname", new ActionError( > "errors.login.noaccountname" ) ); > > > Dominique > > > "Caroline Lauferon" <[EMAIL PROTECTED]> schrieb im Newsbeitrag > news:[EMAIL PROTECTED] > > you have to specify which bundle has to be used. if you don't, Struts > tries > > to use the resources registered under key > org.apache.struts.action.MESSAGE, > > and there is none. > > so you have to specify: by example > > > > hope it helps. > > Caroline > > > > > - > 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: ResourceBundle not available in ActionForm
you have to specify which bundle has to be used. if you don't, Struts tries to use the resources registered under key org.apache.struts.action.MESSAGE, and there is none. so you have to specify: by example hope it helps. Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Tiles, Tabs, Actions - Looking for Tiles experts
Well, I think you can't do it if you keep using SimpleMenuItem and the basic tabsLayout. You have to implement your own menu item, adding an attribute indicating which tab has to be selected. Then you can even not associate a body with a tab. and you have to make a tile-definition for each possible view. // define a layout with 2 tabs // define the different "pages" using this layout // the action of the form has to forward to myResultPage1 definition Hope it helps Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Shouldn't this work?
> onchange="document.forms["logFortrykkForm"].submit()" > > --- > --- > I think it shouldn't have even compiled the JSP, because of the bad parsing of the double quotes. It works with me if I replace the inner double quotes by single quotes: [...] Hope it helps Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: html:hidden +session
I'm quite sure you can use scriptlet in your struts tags : "/> Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: a query regarding
>Also I have an entry in my "struts-config.xml" like the following... > >I also placed the property file in "WEB-INF/classes/" >but it seems that the property file "languages.properties" is not detected. I personnaly would have used : I didn't find any attribute named "property" for message-resources tag in Struts .1.1. dtd Hope it helps Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: struts error on console screen.
this is not an error message, but an information message!! It informs you that the MessageResources are being configured from your file org.apache.struts.action.ActionResources, and that if there is no message for the key you ask for, null will be returned. Hope it helps! Caroline Does anybody have an idea on following error? [INFO] PropertyMessageResources - -Initializing, config='org.apache.struts.action.ActionResources', returnNull=true I am getting this error on console. Regards, Viral -- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: why is there no attribute "name" for in struts???
you have to use StyleId attribute Caroline - Original Message - From: "jagadeesh kumar movva" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, October 14, 2003 11:59 AM Subject: why is there no attribute "name" for in struts??? > Hi, > > I want to submit a form from a frame, while the button > I click to submit is in another frame. I am able to do > this easily using the following code in Model 1 > architecture : > > if((parent.frames["frame3"].document.forms["roadinfo"].name) > == ("roadinfo")){ > > parent.frames["frame3"].document.forms["roadinfo"].action="http://localhost: 8080/examples/jsp/mppp_license/Licenses/roadinfoHandler.jsp"; > // > parent.frames["frame3"].document.forms["roadinfo"].target="_blank"; > > parent.frames["frame3"].document.forms["roadinfo"].buttonType.value > = buttonType; > > parent.frames["frame3"].document.forms["roadinfo"].submit(); > } > } > > But, I find that in struts, there is no attribute > called 'name' for . Then how can I identify the > form which is in the first frame, from the frame in > which the submit button is present? > > Please let me know if there is a way to do this in > struts. > > Thanks > Jag > > > Yahoo! India Matrimony: Find your partner online. > Go to http://yahoo.shaadi.com > > - > 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: Dynamic Menus using tiles definition files
look at one of my last posts about tabsLayout. you can implement your own bean, with a role attribute, and then test it in your layout. Caroline - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, October 09, 2003 2:37 PM Subject: RE: Dynamic Menus using tiles definition files Hi, I dont think you can have logic tags in definition files.But if your menu requirements are simple(Only a few roles for which you have different groups menu items), then you can easily do as follows. Create different menu difinitions for each role. And in the menu.jsp when inserting the definition use the logic tag to insert the appropriate definition. HTH. Regards, Shirish -Original Message- From: Joe @ Team345 [mailto:[EMAIL PROTECTED] Sent: Thursday, October 09, 2003 1:15 PM To: [EMAIL PROTECTED] Subject: Dynamic Menus using tiles definition files So is the above possible? If so, how? Basically, I'd like to have (or notpresent) tags around certain parts of my menu definitions. That is, I would like certain items to only appear under certain circumstances. I can't figure out how to do this in a menu definition file. Has anyone done something like this? My menus are _not_ overly complex; however, I know from my long ago Statistics class that it is completely impractical to define all the possible combinations. Besides that solution is not only ugly, it is not very maintainable. thanks for any thoughts! - 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: All page tiles are not displaying properly
I don't know if you are sure about what you're doing, but I don't understand why you don't just simply: Caroline - Original Message - From: "Appel, Jeremy D" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, October 01, 2003 8:35 PM Subject: All page tiles are not displaying properly I am using Tiles and I am running into a problem that I can not seem to explain. I have all my tiles definitions in the requisite def files etc. I am using the classicLayout tile and all tile values are links to forward actions: with the corresponding action: . For some reason, when accessing actions that reference definitions that display a new page, one of the tiles that comprises the page will not be displayed initially. In order for the entire page to be displayed, I need to hit the refresh button. Can anyone explain this behavior? TIA Jeremy - 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: Dynamically populating tile lists at runtime for menus - Is it possible?
another possibility would be to define a new bean (here, Onglet) with an attribute "roles". In the layout, you verifiy if the role you are in is contained in the roles attribute before displaying the "onglet". Here is a extract of a tiles definition using it: It works great. Hope it helps! Caroline
Re: Not working
1. in your case I think you should use a html:submit. 2. i think your propriety's name should be usergroupmaster, not /usergroupmaster. Caroline - Original Message - From: "Abhijeet Mahalkar" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, October 02, 2003 8:56 AM Subject: Not working > Hi ALL > I have a code in which i have to submit the page for which i have written > > > > //some code > > key="button.details"/> > > > > but when i click the button nothing happens pls suggest what to do? > > thanks In Advance > abhijeet > > > - Original Message - > From: "Andrew Hill" <[EMAIL PROTECTED]> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]> > Sent: Wednesday, October 01, 2003 5:23 PM > Subject: RE: [POLL] ActionFrom vs DynaActionForm > > > > > > if I'm simply copying all my properties to another class > > (Torque Object, EJB, Business Object of some sort) why would I ever need > > code completion for my action forms > > > > > > Indeed, under such situations you would likely be better of with > dynaforms. > > IMHO The real advantages of writing an ActionForm class are when you are > > writing a fair bit of java code that interacts with the form. Having a > solid > > class with strongly typed getters and setters really helps you to keep the > > bugs down by catching many of the simple ones at compile time and of > course > > IDE feature like code completion can save a fair bit of time, and help jog > > the memory (especially when you have a big form with lots of funny named > > fields!) > > > > -Original Message- > > From: Mainguy, Mike [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, 1 October 2003 19:47 > > To: 'Struts Users Mailing List' > > Subject: RE: [POLL] ActionFrom vs DynaActionForm > > > > > > BeanUtils.copyProperties also works with DynaForms (They implement > DynaBean > > and BeanUtils treats them (for the most part) as POJB's (c). > > > > I will concede that code completion is a definite plus. My only counter > to > > that would be that, if I'm simply copying all my properties to another > class > > (Torque Object, EJB, Business Object of some sort) why would I ever need > > code completion for my action forms? > > > > Code completion is a good point anyway though... > > > > -Original Message- > > From: Pratik Patel [mailto:[EMAIL PROTECTED] > > Sent: Wednesday, October 01, 2003 7:29 AM > > To: [EMAIL PROTECTED] > > Subject: Re: [POLL] ActionFrom vs DynaActionForm > > > > +1 ActionForms > > -1 Dyna*Forms > > > > Brandon Goodin wrote: > > > #1 > > > > > > Reasons: > > > -Dynas massive struts configs are annoying and the runtime errors > > > bite. > > > -DynaForm time saving is insignificant (how long does it take for your > > > ide to generate getters/setters?). > > > > > > > more reasons: > > - Easy to copy properties from ActionForm to domain object (using > > BeanUtils.copyProperties ) > > - code completion can be used with ActionForms > > > > > > cheers, > > Pratik > > > > > > > > - > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > This message and its contents (to include attachments) are the property of > > Kmart Corporation (Kmart) and may contain confidential and proprietary > > information. You are hereby notified that any disclosure, copying, or > > distribution of this message, or the taking of any action based on > > information contained herein is strictly prohibited. Unauthorized use of > > information contained herein may subject you to civil and criminal > > prosecution and penalties. If you are not the intended recipient, you > should > > delete this message immediately. > > > > > > > > > > - > > 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: Cannot find message resources under key org.apache.struts.action.MESSAGE
> In my JSP Page I display a Hello message. If it is US..it should display HI and if it is French it displays BONJOIR > Basically I ma using MESSAGE. > > In my ApplicationResources_en.properties I have: > index.html=Hi > > and in In my ApplicationResources_fr.properties I have: > index.html=BONJOIR So, you have put in your jsp : , havn't you? > My STRUTS.XML file has following: > > > and then I store the files in > C:\strutsShop\WEB-INF\properties\Application_en.properties your files should be ApplicationResources_en.properties and ApplicationResources_fr.properties. I think that's the problem. > Also the above location is present in my CLASSPATH. > > But when I execute the page on URL, I get javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE I know it doesn't matter by now, but I'm french and you should say Bonjour instead of Bonjoir ;-) Hope it helps, Caroline - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: No bean specified
or maybe you didn't define which bean to use for this action (name parameter of action in struts-config) Hope it helps Caroline - Original Message - From: "Mike Jasnowski" <[EMAIL PROTECTED]> To: "Struts Users Mailing List" <[EMAIL PROTECTED]> Sent: Tuesday, September 30, 2003 3:38 PM Subject: RE: No bean specified > This generally means that somewhere you named a bean, either in a tag or a > call to some BeanUtils method. However the bean name specified could not be > located, perhaps it's in the wrong scope, perhaps it's using a wrong value > for the "name" attribute on a tag. > > -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 30, 2003 6:36 AM > To: [EMAIL PROTECTED] > Subject: No bean specified > > > Hi all, > Does anybody know what causes this exception?? > > javax.servlet.ServletException: BeanUtils.populate > org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254) > > org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j > ava:821) > > org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) > > org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) > > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) > javax.servlet.http.HttpServlet.service(HttpServlet.java:763) > javax.servlet.http.HttpServlet.service(HttpServlet.java:856) > > > java.lang.IllegalArgumentException: No bean specified > > org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptor(PropertyUti > ls.java:837) > > org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:934) > org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808) > org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252) > > org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.j > ava:821) > > org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254) > > org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) > > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) > javax.servlet.http.HttpServlet.service(HttpServlet.java:763) > javax.servlet.http.HttpServlet.service(HttpServlet.java:856) > > - > 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: change dynamically ApplicationResources path
Thanks a lot!! I used the second method (see code below). Caroline in struts-config.xml : public class ExternPropertyMessageResourcesFactory extends PropertyMessageResourcesFactory { public MessageResources createResources(String config) { return new ExternPropertyMessageResources(this, config, this.returnNull); } } public class ExternPropertyMessageResources extends PropertyMessageResources { // --- Constructors /** * Construct a new PropertyMessageResources according to the * specified parameters. * * @param factory The MessageResourcesFactory that created us * @param config The configuration parameter for this MessageResources */ public ExternPropertyMessageResources(MessageResourcesFactory factory,String config) { super(factory, config); log.info("Initializing, config='" + config + "'"); } /** * Construct a new PropertyMessageResources according to the * specified parameters. * * @param factory The MessageResourcesFactory that created us * @param config The configuration parameter for this MessageResources * @param returnNull The returnNull property we should initialize with */ public ExternPropertyMessageResources(MessageResourcesFactory factory,String config, boolean returnNull) { super(factory, config, returnNull); log.info("Initializing, config='" + config +"', returnNull=" + returnNull); } // - Properties /** * The set of locale keys for which we have already loaded messages, keyed * by the value calculated in localeKey(). */ protected HashMap locales = new HashMap(); /** * The Log instance for this class. */ protected static final Log log =LogFactory.getLog(ExternPropertyMessageResources.class); /** * Load the messages associated with the specified Locale key. For this * implementation, the config property should contain a fully * qualified package and resource name, separated by periods, of a series * of property resources to be loaded from the class loader that created * this PropertyMessageResources instance. This is exactly the same name * format you would use when utilizing the * java.util.PropertyResourceBundle class. * * @param localeKey Locale key for the messages to be retrieved */ protected synchronized void loadLocale(String localeKey) { log.info("Recuperation des messages loadLocale("+ localeKey +")"); if (log.isDebugEnabled()) { log.debug("loadLocale(" + localeKey + ")"); } // Have we already attempted to load messages for this locale? if (locales.get(localeKey) != null) { return; } locales.put(localeKey, localeKey); InputStream is = null; Properties props = new Properties(); try{ String fileURL = System.getProperty("URL_UTIL_PROPERTIES")+"ApplicationResources.properties"; // System.out.println("on essaie de lire le fichier"+fileURL); URL url=null; try { url = new URL(fileURL); } catch (Exception e){ log.error("probleme a la recuperation de l'URL"); } String fileName = url.getFile(); is = new FileInputStream(fileName); } catch (FileNotFoundException fnfe) { log.error("Fichier inexistant"); // System.out.println("Fichier pas la!"); } if (is != null) { try { props.load(is); // System.out.println("props="+props); } catch (IOException e) { log.error("loadLocale()", e); } finally { try { is.close(); } catch (IOException e) { log.error("loadLocale()", e); } } } if (log.isTraceEnabled()) { log.trace(" Loading resource completed"); } // Copy the corresponding values into our cache if (props.size() < 1) { return; } synchronized (messages) { Iterator names = props.keySet().iterator(); while (names.hasNext()) { String key = (String) names.next(); if (log.isTraceEnabled()) { log.trace(" Saving message key '" + messageKey(localeKey, key)); } messages.put(messageKey(localeKey, key), props.getProperty(key)); } } } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
change dynamically ApplicationResources path
Hello, I would like to know if it is possible to set the path of the ApplicationResources.properties file without hard-coding it in struts-config.xml. Indeed, I would like to read a property file (whose path is in an environment property) which would contain the path of the ApplicationResources to use. This would allow me to deploy my EAR, and then, without having to re-generate it and re-deploy it, change the ApplicationResources file. Thanks, Caroline