Yes I also think that only positional parameters would work, which means I
have to create another message just for this case. Struts 2 should allow
developers to use messages with positional parameters with the validation
framework so you can have just one type of message.

-----Mensaje original-----
De: Dave Newton [mailto:newton.d...@yahoo.com] 
Enviado el: Monday, January 26, 2009 11:10 AM
Para: Struts Users Mailing List
Asunto: [!! SPAM] Re: S2 Using <s:text/> with parameters

Néstor Boscán wrote:
> message.requiredfield = The field "${getText(fieldName)}" is required
> 
> Now I need to do some extra javascript validations where I need to get the
> message from the property files but I can’t get:
> 
> <s:text name="message.requiredfield"><s:param name="fieldName"
> value="projectDocument"/></s:text>

I don't think that's how it would work; if I had to guess I'd say that 
only positional message parameters would be possible--could be wrong 
about that.

That said, you can still call the getText() variant that takes a list or 
an array--this should be doable using OGNL syntax; something like:

<s:property value="getText('message.requiredField',
                            { 'projectDocument' })"/>

IIRC you can also construct actual arrays:

<s:property value="getText('message.requiredField',
                            new String[] { 'projectDocument' })"/>

if the first way doesn't work.

Dave


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


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

Reply via email to