On Fri, 8 Jun 2012 01:08:17 +0530
Dishara Wijewardana <[email protected]> wrote:
> Hi all,
> In velocity if the foo is an already set String variable or String
> variable that has a value
> $foo will be the echo statement.
>
> In JSR223 we have an option to getOutputStatement(String output). It
> should return the script language specific echo statement syntax.
From what I read in the specs, getOutputStatement(String str) doesn't
have anything to do with variables, it's simply the way to echo the
content of the str string.
So apart from any escaping consideration, this method should simply
return str without any processing. And yes, we should also consider
escaping here. If the user wants to echo "$foo", we should echo
something like "#[[$foo]]#" (using the new unparsed content syntax).
> But after we implement this API, we can do this in this API
> as context.getWriter().write(foo).
> So if the context is inherits to the page (which is what happens in
> general), can we also provide something like
> ${context.getWriter().write(foo)} ?
> Or are we going to use the $foo instead ?
>
None of them, see above...
Be really careful when you talk about 'contexts', because they mean
different things in Velocity and in the JSR 223. I guess you're talking
about the JSR 223 context here.
About the terminology, my proposal is to always use the term "script
context" (and the ScriptContext corresponding variable name) when we
talk about JSR 223 contexts, and to use always use the term "velocity
context" for Velocity contexts.
I don't know if the script context itself is to be present in the
bindings (i.e. in the Velocity context). If so, we should name it
$scriptContext rather than $context, since we already use the later
for exposing a Velocity context to itself via the ContextTool.
Claude
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]