You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by laredotornado <la...@gmail.com> on 2009/03/12 18:41:38 UTC

How can I tell if Struts is finding my messages file?

Hi,

I'm using Struts 1.  In my ActionForm's validate method, I have a section of
code ...

			final ActionMessage am = new
ActionMessage("error.accountNum.wrong.length");
			errors.add(ACCOUNT_NUM_PARAM_NAME,am);

My question is how can I verify that the property
"error.accountNum.wrong.length" is found in my message resource file?  Is
there a way I can get the value of the property,
"error.accountNum.wrong.length" within my validate method?

Thanks, - Dave


		
-- 
View this message in context: http://www.nabble.com/How-can-I-tell-if-Struts-is-finding-my-messages-file--tp22481715p22481715.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How can I tell if Struts is finding my messages file?

Posted by Lalchandra Rampersaud <lr...@ceis.cujae.edu.cu>.
You could have a class like this implemented...

package additionalClasses;

import java.util.ResourceBundle;


public class MessageBundle {

    private static final String DEFAULT_BUNDLE_NAME = 
"teamsoftSite.ApplicationResources";
    private static ResourceBundle defaultBundle = 
ResourceBundle.getBundle(DEFAULT_BUNDLE_NAME);

    public static String getMessage(String key) {
 return defaultBundle.getString(key);
    }
}

and later call the getMessage function
MessageBundle.getMessage("assignRole.incompWorkers")

saludos
lalchandra rampersaud


----- Original Message ----- 
From: "laredotornado" <la...@gmail.com>
To: <us...@struts.apache.org>
Sent: Thursday, March 12, 2009 10:41 AM
Subject: How can I tell if Struts is finding my messages file?


>
> Hi,
>
> I'm using Struts 1.  In my ActionForm's validate method, I have a section 
> of
> code ...
>
> final ActionMessage am = new
> ActionMessage("error.accountNum.wrong.length");
> errors.add(ACCOUNT_NUM_PARAM_NAME,am);
>
> My question is how can I verify that the property
> "error.accountNum.wrong.length" is found in my message resource file?  Is
> there a way I can get the value of the property,
> "error.accountNum.wrong.length" within my validate method?
>
> Thanks, - Dave
>
>
>
> -- 
> View this message in context: 
> http://www.nabble.com/How-can-I-tell-if-Struts-is-finding-my-messages-file--tp22481715p22481715.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

VI Conferencia Internacional de Energía Renovable, Ahorro de Energía y Educación Energética
9 - 12 de Junio 2009, Palacio de las Convenciones
...Por una cultura energética sustentable
www.ciercuba.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org