El lun, 22 de 05 de 2006 a las 18:43, fea jabi escribió:
Thanks, but remember that it's in a ActionForm subclass.

getLocale() and getResources() aren't avaliable. Those are Action
methods.

Can i get Action from ActionFrom?

>         Locale locale = getLocale(request);
>         MessageResources messageResources = getResources(request);
> 
>         messageResources.getMessage(locale, "lbl.payout");
> 
> 
> 
> >From: Jorge Martn Cuervo <[EMAIL PROTECTED]>
> >Reply-To: "Struts Users Mailing List" <user@struts.apache.org>
> >To: user@struts.apache.org
> >Subject: get ResourceBundle in ActionForm subclass
> >Date: 22 May 2006 16:13:46 +0200
> >
> >Hi all,
> >
> >i want to use externalized messages in the validation errors of a
> >ActionForm subclass.
> >
> >I have this code:
> >
> >[...]
> >public ActionErrors validate(ActionMapping mapping, HttpServletRequest
> >request) {
> >
> >             ActionErrors errors = new ActionErrors();
> >
> >             /*
> >              * required fields
> >              */
> >             if (orgName == null || orgName.equals("")) {
> >                     errors.add("orgName", new
> >ActionMessage("employer.orgName.requiredfield"));
> >             }
> >[...]
> >
> >and works pretty good, but i want to use ActionMessages with a parameter
> >with the name of the required field. For instance:
> >
> >[...]
> >             if (orgName == null || orgName.equals("")) {
> >                     errors.add("orgName", new
> >
> >ActionMessage("employer.requiredfield", "employer.orgName"));
> >             }
> >[...]
> >
> >But in jsp view, it generates
> >
> >"employer.orgName is required"
> >
> >
> >I want to get the ResourceBundle to "translate" the employer.orgName to
> >the value assigned in .properties file.
> >
> >How can i do it?
> >
> >thanks
> >
> >--
> >;-)
> >____________________________________
> >Jorge Martin Cuervo
> >Analista Programador
> >
> >Outsourcing Emarketplace
> >deFacto Powered by Standards
> >
> >email <[EMAIL PROTECTED]>
> >voz +34 985 129 820
> >voz +34 660 026 384
> >____________________________________
> >
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> _________________________________________________________________
> On the road to retirement? Check out MSN Life Events for advice on how to 
> get there! http://lifeevents.msn.com/category.aspx?cid=Retirement
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

-- 
;-)
____________________________________
Jorge Martin Cuervo
Analista Programador

Outsourcing Emarketplace
deFacto Powered by Standards

email <[EMAIL PROTECTED]>
voz +34 985 129 820
voz +34 660 026 384
____________________________________

Reply via email to