RE: externalizing the button hashmap for the LookupDispatchAction ?
I've done it with a LookupMethods.properties file that contains the following: button.add=add button.cancel=cancel button.copy=copy button.edit=edit button.delete=delete button.save=save button.search=search Then I have the following method in my BaseAction class: /** * Provides the mapping from resource key to method name * * @return Resource key / method name map */ public Map getKeyMethodMap() { Map map = new HashMap(); ResourceBundle methods = ResourceBundle.getBundle("org.appfuse.webapp.action.LookupMethods"); Enumeration keys = methods.getKeys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); map.put(key, methods.getString(key)); } return map; } It's not much better, but it does make it a *bit* easier to manage. HTH, Matt -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 1:37 PM To: struts Subject: externalizing the button hashmap for the LookupDispatchAction? I am just wondering if anyone has already made a nicer way to manage the hashmap for the button labels on the LookupDispatchAction? I hate having to continually add elements in the code when I add a new button. --- Thanks Mick Knutson coming soon: Your SOS: Your personal emergency contact system. http://YourSoS.com +001(805) 563-0666 Office +001 (708) 570-2772 Fax --- - 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: externalizing the button hashmap for the LookupDispatchAction?
Thanks. That is heaps easier than hacking the code each time. Much appreciated! --- Thanks Mick Knutson coming soon: Your SOS: Your personal emergency contact system. http://YourSoS.com +001(805) 563-0666 Office +001 (708) 570-2772 Fax --- - Original Message - From: "Matt Raible" <[EMAIL PROTECTED]> To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]> Sent: Tuesday, September 30, 2003 12:41 PM Subject: RE: externalizing the button hashmap for the LookupDispatchAction? > I've done it with a LookupMethods.properties file that contains the > following: > > button.add=add > button.cancel=cancel > button.copy=copy > button.edit=edit > button.delete=delete > button.save=save > button.search=search > > Then I have the following method in my BaseAction class: > > /** > * Provides the mapping from resource key to method name > * > * @return Resource key / method name map > */ > public Map getKeyMethodMap() { > Map map = new HashMap(); > > ResourceBundle methods = > > ResourceBundle.getBundle("org.appfuse.webapp.action.LookupMethods"); > > Enumeration keys = methods.getKeys(); > > while (keys.hasMoreElements()) { > String key = (String) keys.nextElement(); > map.put(key, methods.getString(key)); > } > > return map; > } > > It's not much better, but it does make it a *bit* easier to manage. > > HTH, > > Matt > > -Original Message- > From: Mick Knutson [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 30, 2003 1:37 PM > To: struts > Subject: externalizing the button hashmap for the LookupDispatchAction? > > > I am just wondering if anyone has already made a nicer way to manage the > hashmap for the button labels on the LookupDispatchAction? > I hate having to continually add elements in the code when I add a new > button. > > --- > Thanks > Mick Knutson > > coming soon: > Your SOS: Your personal emergency contact system. > http://YourSoS.com > > +001(805) 563-0666 Office > +001 (708) 570-2772 Fax > --- > > - > 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: externalizing the button hashmap for the LookupDispatchAction ?
But if your adding a new button then you will have to add the new code for it anyways. So would this help? If it was something that would allow you to not have to redeploy then it might make sense but really we are just talking about one more line of code ;) -Tim -Original Message- From: Matt Raible [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 3:42 PM To: 'Struts Users Mailing List' Subject: RE: externalizing the button hashmap for the LookupDispatchAction ? I've done it with a LookupMethods.properties file that contains the following: button.add=add button.cancel=cancel button.copy=copy button.edit=edit button.delete=delete button.save=save button.search=search Then I have the following method in my BaseAction class: /** * Provides the mapping from resource key to method name * * @return Resource key / method name map */ public Map getKeyMethodMap() { Map map = new HashMap(); ResourceBundle methods = ResourceBundle.getBundle("org.appfuse.webapp.action.LookupMethods"); Enumeration keys = methods.getKeys(); while (keys.hasMoreElements()) { String key = (String) keys.nextElement(); map.put(key, methods.getString(key)); } return map; } It's not much better, but it does make it a *bit* easier to manage. HTH, Matt -Original Message- From: Mick Knutson [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 30, 2003 1:37 PM To: struts Subject: externalizing the button hashmap for the LookupDispatchAction? I am just wondering if anyone has already made a nicer way to manage the hashmap for the button labels on the LookupDispatchAction? I hate having to continually add elements in the code when I add a new button. --- Thanks Mick Knutson coming soon: Your SOS: Your personal emergency contact system. http://YourSoS.com +001(805) 563-0666 Office +001 (708) 570-2772 Fax --- - 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]