You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Manish <pr...@gmx.net> on 2004/10/14 06:46:24 UTC
List all objects available in context
Is it possible to list all objects available in the current context in the
velocity template?
How can I do that?
TIA,
- Manish
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: List all objects available in context
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Manish,
> And how do I put current context in the context?
That's simple. Say you have
Context context;
in you java code. Just do
context.put("ctx", context);
cf. http://jakarta.apache.org/velocity/api/org/apache/velocity/context/Context.html
> Shouldn't context be available by default?
Why? At least I don't need it there in most cases.
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: List all objects available in context
Posted by Manish <pr...@gmx.net>.
>
> > Is it possible to list all objects available in the current context in
the
> > velocity template?
> Only if you have the current context itself in the context.
>
And how do I put current context in the context?
Shouldn't context be available by default?
- Manish
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org
Re: List all objects available in context
Posted by Shinobu Kawai <sh...@gmail.com>.
Hi Manish,
> Is it possible to list all objects available in the current context in the
> velocity template?
Only if you have the current context itself in the context.
> How can I do that?
If the context is in the context as $ctx, you can do this:
#foreach($key in $ctx.keys)
$key = $ctx.get($key)
#end
Best regards,
-- Shinobu Kawai
--
Shinobu Kawai <sh...@gmail.com>
---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org