[S2] message properties

2007-12-21 Thread Desbois Arnaud
I want to customize the messages properties (like struts 1) with {0}
variable:

 

message.remove=Are you sure you want to remove: {0}?

 

But how I can call in my JSP the message with the variable?

 

I try this, but it doesn't work:

s:set var=msg value=%{getText('message.remove', item.name)} /

s:set var=msg value=%{getText('message.remove', {item.name})} /

s:set var=msg value=%{getText('message.remove', #{item.name})} /

 

 

Also, how I can retrieve a message from the resources.properties from a
freemarker template (.ftl file)?

 

Regards

Arnaud.

 



Re: [S2] message properties

2007-12-21 Thread Maxx
In a JSP, it's quite easy, you just have to use a nested s:param
inside the tag refering to your message, e.g.

s:text name=message.remove
s:param name=value value=item.name /
/s:text
(of course if item is available through your action via a getItem()
method - same for property name on your item)

For the Freemarker thing, I unfortunately don't know.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [S2] message properties

2007-12-21 Thread Desbois Arnaud
But with the set tag, it doesn't work:

s:set var=msg value=%{getText('message.remove')} 
s:param name=value value=item.name /
/s:set


-Message d'origine-
De : Maxx [mailto:[EMAIL PROTECTED] 
Envoyé : vendredi 21 décembre 2007 12:20
À : Struts Users Mailing List
Objet : Re: [S2] message properties

In a JSP, it's quite easy, you just have to use a nested s:param
inside the tag refering to your message, e.g.

s:text name=message.remove
s:param name=value value=item.name /
/s:text
(of course if item is available through your action via a getItem()
method - same for property name on your item)

For the Freemarker thing, I unfortunately don't know.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [S2] message properties

2007-12-21 Thread Dave Newton
--- Desbois Arnaud [EMAIL PROTECTED] wrote:
 But with the set tag, it doesn't work:
 
 s:set var=msg value=%{getText('message.remove')} 
   s:param name=value value=item.name /
 /s:set

For completeness you should add how you're accessing the variable you've set,
as that can also be a potential issue. (I don't believe this method would
work for positional parameters, though.)

d.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: [S2] message properties

2007-12-21 Thread Dave Newton
--- Desbois Arnaud [EMAIL PROTECTED] wrote:
 s:set var=msg value=%{getText('message.remove', item.name)} /
 s:set var=msg value=%{getText('message.remove', {item.name})} /
 s:set var=msg value=%{getText('message.remove', #{item.name})} /

I would have thought the second example would have worked; I use nearly the
same syntax with an iterator value and it works fine (although I'm using
s:property.../).

I just verified that if I have an action property foo that the following
works.

s:set name=meh value=%{getText('test.msg', {foo})}/
s:property value=#meh/

 Also, how I can retrieve a message from the resources.properties from a
 freemarker template (.ftl file)?

You can always use an s:property.../ tag where the value is the getText
call. All the S2 tags can be used in a FreeMarker template, AFAIK.

d.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]