Hi Nathan,
i tried it but the line:
$messageService.getMessage("start.index.welcome",[$userSession.user.firstName].toArray())
fails and the following exception is thrown:
org.apache.velocity.exception.ParseErrorException: Encountered "." at
line 10, column 95 of start_index.xhtml
Was expecting one of:
"," ...
")" ...
<WHITESPACE> ...
Nathan Bubna schrieb:
On 8/31/07, Simon Buettner <[EMAIL PROTECTED]> wrote:
As long as there is no solution i could overload the method like
public String getMessage(String key, String[] values)
but event this is, as far as is know, not possible.
$messageService.getMessage("start.index.welcome" ,[$userSession.user.firstName])
This line has the same effect. The expression is not parsed.
That's because Velocity's so-called "array syntax" actually creates a
java.util.List. try doing:
$messageService.getMessage("start.index.welcome",
[$userSession.user.firstName].toArray())
i haven't tested this, but i think it should work.
Nathan Bubna schrieb:
This is a known shortcoming. https://issues.apache.org/jira/browse/VELOCITY-534
I've some ideas of how we might solve this, but i've been busy with
other stuff. If anyone wants to dig into this, i'd be happy to share
my thoughts. Patches are welcome, as always! :)
On 8/31/07, Simon Buettner <[EMAIL PROTECTED]> wrote:
Hi everyone,
i want to call the following method with a variable-length argument list:
public String getMessage(String key, String ...values)
And this is the velocity template code:
$messageService.getMessage("start.index.welcome" ,
$userSession.user.firstName)
The template is parsed without any errors, but the method is not called.
It just puts out:
$messageService.getMessage("start.index.welcome" ,
$userSession.user.firstName)
Best regards
Simon
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]