Gentlemen-

Here is my problem (well, one of them at least):

My resource bundle names don't correspond to my class names. Therefore I
have overridden the getTexts() method in ActionSupport to suit my own
purposes.  The difficulty arises in ActionSupport's getText() method. It
searches for a resource bundle in the current class and then on up the class
hierarchy until it finds one.  However, it does so by calling
getTexts(Class.getName()).  Can I suggest that it first tries to get the
resource bundle by calling getTexts() before searching using the names going
up the class hierarchy?  With the default behavior of getTexts(), this would
amount to the same thing, but it would accommodate people like me.  I'm not
sure if this works, but I think the resulting method would look something
like this:

 public String getText(String aTextName)
   {
      Class thisClass = getClass();
      MissingResourceException e;
        ResourceBundle bundle;
     try
     {
       bundle = getTexts();
       return bundle.getString(aTextName);
     } catch (MissingResourceException mre)
     {
         do
          {
             try
             {
                bundle = getTexts(thisClass.getName());
                return bundle.getString(aTextName);
             } catch (MissingResourceException ex)
             {
                e = ex;
                thisClass = thisClass.getSuperclass();
             }
          } while (!thisClass.equals(Object.class));
     }

      throw e;
   }

Thanks,

Geoff




-------------------------------------------------------
This SF.net email is sponsored by: Microsoft Visual Studio.NET 
comprehensive development tool, built to increase your 
productivity. Try a free online hosted session at:
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr0003en
_______________________________________________
Opensymphony-webwork mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/opensymphony-webwork

Reply via email to