You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Haroon Rafique <ha...@utoronto.ca> on 2007/10/28 14:51:01 UTC

freemarker static method call using stack.findValue and @@

Hi there,

In my freemarker template, I'm trying to make a static method call using 
the following syntax to call the java.lang.Math.min() method:
 	${stack.findValue("@@min(555, 222)")}

Now this works fine.

However, if I start using variables instead of values like 222, 555, e.g.:
 	${stack.findValue("@@min(555, input)")}
where input is defined as:
 	<#assign input="222"/>

I get the exception:

freemarker.core.InvalidReferenceException: Expression 
stack.findValue("@@min(555, input)") is undefined

Anyone have any similar experiences? Words of wisdom? I must be missing 
something simple.

I have tried using #input but that didn't work either.

I'm using struts 2.0.11, freemarker 2.3.10 and ognl 2.6.11

Thanks in advance and cheers,
--
Haroon Rafique
<ha...@utoronto.ca>


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


Re: [SOLVED] freemarker static method call using stack.findValue and @@

Posted by Haroon Rafique <ha...@utoronto.ca>.
On Today at 9:51am, HR=>Haroon Rafique <ha...@utoronto.ca> wrote:

HR> [..snip..]
HR> 
HR> However, if I start using variables instead of values like 222, 555, e.g.:
HR> 	${stack.findValue("@@min(555, input)")}
HR> where input is defined as:
HR> 	<#assign input="222"/>
HR> 
HR> I get the exception:
HR> 
HR> freemarker.core.InvalidReferenceException: Expression
HR> stack.findValue("@@min(555, input)") is undefined
HR> 
HR> Anyone have any similar experiences? Words of wisdom? I must be missing
HR> something simple.
HR> 
HR> I have tried using #input but that didn't work either.
HR> 

Go figure... As soon as I post the email, I figured it out (5 minutes 
later).

Use:
	stack.findValue("@@min(555, ${input})")

Works for me.

Sorry for the noise.
--
Haroon Rafique
<ha...@utoronto.ca>


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