I've found Nick Heudecker's tutorial helpful
on this subject:
http://www.systemmobile.com/articles/strutsMessageResources.html


Ashutosh Satyam wrote:
> Hi,
>  In my application I want to set the error key based on whether 
> the error key is present in resource bundle. The error key is 
> generated in the system and the top most layer 'Action class' is 
> supposed to set the keys based on the error key availability.
> 
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> Sample/Pseudo code demonstrating what I exactly tend to do.
> 
> String key = null;
> String[] param = null;
> 
> ResourceBundle bundle =  getBudle();
> if("a.b.c.d".isPresent(bundle))
>       key = "a.b.c.d";
>       param = new String[2]
>             param[0]="s1";
>             param[1]="s2;
> elseif("a.b.c."isPresent(bundle))
>       key = "a.b.c";
> elseif("a.b".isPresent(bundle))
>       key="a.b";
> elseif("a".isPresent(bundle))
>       key = "a"
> else
>       key = "default.errorkey";
> 
> ActionErrors errors = new ActionErrors();
> If(param != null)
>  errors.add(ActionErrors.GLOBAL_ERROR,
> new ActionError(key,params));
> else
>  errors.add(ActionErrors.GLOBAL_ERROR,
> new ActionError(key,params));
> 
> saveErrors(req,errors);
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
> 
> Is there a handle available through Struts framework to read Resource Bundle 
> so that I can look whether a particular key is present or not and accordingly 
> construct ActionError.
> 
> Any pointers on this will be appreciated.
> 
> Thansk & Regards,
> Ashutosh
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


-- 
The most beautiful thing we can experience is the mysterious.
It is the source of all true art and science.
- Albert Einstein

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to