struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alberto A. Flores" <aaflo...@gmail.com>
Subject Re: Resource Bundles and token replacement
Date Thu, 13 Dec 2007 13:17:33 GMT
Thanks Wes,

Thanks for your help. The snippet you wrote is valid code, however I was 
hoping for a similar solution where I only need to use the

<s:fieldError />

Normally in Struts 1.x, I'll write <html:errors/> and in my 
validation.xml, I would define the field to validate and the key to add 
to be replaced for the {0} variable. Do you know if this can be done in 
Struts 2.x? I suspect that I can write my own template, but I really 
would hate to do it just for this case.

Wes Wannemacher wrote:
> I could be wrong, but if you are using the s:text tag, you can specify
> an s:param that will be used. I could be wrong, and hopefully someone
> will correct me if I am but -
> 
> <s:text name="mesage.key">
>     <s:param>Mr. Smith</s:param>
> </s:text>
> 
> package.properties -
> message.key=Hello {0}
> 
> The docs aren't real specific on it, but there is some information here -
> http://struts.apache.org/2.0.11/docs/text.html
> 
> On 12/12/07, Alberto A. Flores <aaflores@gmail.com> wrote:
>> In struts 1.x, a resource bundle can have:
>>
>> errors.required={0} is required.
>>
>> And the validation.xml files will have a param set to the token (key) to
>> be plugged in the {0} variable. Is there such a functionality in Struts 2?
>>
>> I have been able to only print one resource bundle using the key
>> attribute in the <message key=""> tag. The closes I've made it is to
>> display the name of the validated field doing:
>>
>> errors.required=${getText(fieldName}} is required.
>>
>>
>> If the only alternatively is to write my own template, can someone point
>> in the right direction in where, how to get started.
>>
>> Hope this is not a big question.
>>
>> Thanks,
>>
>>
>> --
>>
>> Alberto A. Flores
>> http://www.linkedin.com/in/aflores
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
> 
> 

-- 

Alberto A. Flores
http://www.linkedin.com/in/aflores



Mime
View raw message