You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by omar Martin Velasco <bi...@hotmail.com> on 2008/01/17 13:43:55 UTC

Inject new objects to roller templates

Hi,

We are using roller 4 and we have created a filter that process every roller request. In the filter, we wanna inject a velocity object to the velocity context and read it from the templates. We have trying to set the attribute in the session like:

     request.getSession().setAttribute('name', object);

 In the template we try to get the attribute like:

     #set($name=$request.getHttpServletRequest().getSession().getAttribute('name'))

but this doesn't work.
        
Thanks for any advice!
_________________________________________________________________
MSN Video. 
http://video.msn.com/?mkt=es-es

Re: Inject new objects to roller templates

Posted by Dave <sn...@gmail.com>.
On Jan 17, 2008 4:43 AM, omar Martin Velasco <bi...@hotmail.com> wrote:
> We are using roller 4 and we have created a filter that process every roller request. In the filter, we wanna inject a velocity object to the velocity context and read it from the templates. We have trying to set the attribute in the session like:
>
>      request.getSession().setAttribute('name', object);
>
>  In the template we try to get the attribute like:
>
>      #set($name=$request.getHttpServletRequest().getSession().getAttribute('name'))
>
> but this doesn't work.

There is no $request object in Roller. If you want to add a new model
object to Roller, then implement the PageModel interface. This email
has some details: http://markmail.org/message/eefvzetzvkjzi76x

- Dave