struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Honza Spurný <spu...@master.cz>
Subject Re: MessageResources in ActionForm
Date Tue, 25 Nov 2003 10:06:19 GMT
Manish Singla wrote:
> Hi
>
> Use following
>
> MessageResources mr = ((MessageResources)
> request.getAttribute(Globals.MESSAGES_KEY));
                       ^^^^^^^^

what is Globals ??? I've tried it, but my java compiler does not knows it...

>
> Instaed of
>
>>  MessageResources mr = request.getMessageResources();
>
> HTH
> Manish Singla
>
>
>
> Honza Spurný wrote:
>> Hi there,
>>
>> I'm able to read values from MessageResources in JSP files. But in
>> special case I need to read such values in java-classes.
>> Unfortunatelly I need it in ActionForm in validate() method...
>>
>> To understand me I'm attaching my vision of how it could be very
>> easy (it doesn't work):
>>
>> public ActionErrors validate(ActionMapping mapping,
>> HttpServletRequest request){
>>   MessageResources mr = request.getMessageResources();
>>   ActionErrors errors = new ActionErrors();
>>
>>   if (anyReasonToFailValidation){
>>     errors.add("Error found", new ActionError("key.to.this.error",
>> mr.getMessage("key.to.errorMessageParameter")));
>>
>>   return errors;
>> }
>>
>> I think it's clear why I need to have an object of Messageresources
>> in ValidatorForm.
>>
>> Please, could anybody help me?
>>
>> Thanks a lot.
>> Sporak
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: struts-user-help@jakarta.apache.org


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


Mime
View raw message