This gives me an interesting idea.  Perhaps we (someone) could write a
ContextTool that would be able to return a list of all available
values even in a ViewContext (i.e. one that chains request, session,
and application attributes).  That would make it so you only need to
add the tool to your toolbox, rather than subclass the servlet.

It shouldn't be difficult.  Perhaps i'll do it today if i need a break
from other things.

On 10/18/06, Claude Brisson <[EMAIL PROTECTED]> wrote:
By default, the context is not included in itself, but you can still
list the values in the session, request or response (or also in the
servlet context, known as "application") with the following loops:

#foreach($key in $request.attributeNames) ...

#foreach($key in $session.attributeNames) ...

#foreach($key in $application.attributeNames) ...


If you need the context to have a key towards itself, you have to
subclass the VelocityViewServlet, and inherit createContext like this:

    protected Context createContext(HttpServletRequest request,
                                    HttpServletResponse response)
    {
       Context context = super.CreateContext(request,response);
       context.put("context",context);
    }


You can then iterate on values of the context like this:

<ul>
#foreach($key in $context.keys)
<li>$key = $context.get('$key')
#end
</ul>

but the values in the request, session, response and application won't
appear in this list.


  Claude

Le mardi 17 octobre 2006 à 18:18 -0400, Charles Harvey III a écrit :
> Hello.
> If I am using the VelocityLayoutServlet where all things that I put into
> the request, response and session automatically go into the $context.
>
> So... how do I get a list of all the values in the $context?  Just for
> starters, how do I access the $context?  It is not with "$context".
>
> I can access $request, $response and $session.  So, how do I get at the
> $context?
>
> Thanks much.
>
>
> Charlie
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to