You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Raymond Auge <ra...@liferay.com> on 2009/04/02 18:16:53 UTC

upstream object changes

Hey All,

I need to push some details up the processing chain. If I inject an
object like a Map into the context, and from within VTL call "add(Object
o)" on it, shouldn't this change be visible from outside the context,
once execution of the template is done?

The use case is tagging. Our application has several tier of content
processing.

- servlet
    - theme
        - N portlets
            - CMS content

Only the servlet has access to write tags into the meta fields of the
page, but N CMS contents and other objects have tags for inclusion.

The issue is that for a couple reason we don't pass the real request
object all the way through to the CMS processing. BUT, I want to enable
CMS template developers to have the ability to submit tags
programatically.

So, I'd like to provide something like:

#set ($VOID = $tags.add("..."))

These would get collected post template into the actual request and at
the servlet level verified and added to the meta information of the
page. 

But, my initial tests aren't working, so either I'm doing something
wrong (it's just a HashMap<String, String> that I'm using) or it's not
possible.


--
Raymond Augé
Senior Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.

--
Liferay East Coast User Conference 2009
May 21, 2009
Reston, Virginia

www.liferay.com/events/ecuc09 



Re: upstream object changes

Posted by Raymond Auge <ra...@liferay.com>.
On Thu, 2009-04-02 at 09:44 -0700, Nathan Bubna wrote:

> I'm confused; is $tags the HashMap<String,String> in question?  If so,
> there's no add(String) method, only put(String,String).

The operative word is probably "d'oh".

Sorry for the noise... it's been a long week.

--
Raymond Augé
Senior Software Engineer
Liferay, Inc.
Enterprise. Open Source. For Life.
--
Liferay East Coast User Conference 2009
May 21, 2009
Reston, Virginia

www.liferay.com/events/ecuc09 


Re: upstream object changes

Posted by Nathan Bubna <nb...@gmail.com>.
On Thu, Apr 2, 2009 at 9:16 AM, Raymond Auge <ra...@liferay.com> wrote:
> Hey All,
>
> I need to push some details up the processing chain. If I inject an
> object like a Map into the context, and from within VTL call "add(Object
> o)" on it, shouldn't this change be visible from outside the context,
> once execution of the template is done?

Yes.

> The use case is tagging. Our application has several tier of content
> processing.
>
> - servlet
>    - theme
>        - N portlets
>            - CMS content
>
> Only the servlet has access to write tags into the meta fields of the
> page, but N CMS contents and other objects have tags for inclusion.
>
> The issue is that for a couple reason we don't pass the real request
> object all the way through to the CMS processing. BUT, I want to enable
> CMS template developers to have the ability to submit tags
> programatically.
>
> So, I'd like to provide something like:
>
> #set ($VOID = $tags.add("..."))

I'm confused; is $tags the HashMap<String,String> in question?  If so,
there's no add(String) method, only put(String,String).

> These would get collected post template into the actual request and at
> the servlet level verified and added to the meta information of the
> page.
>
> But, my initial tests aren't working, so either I'm doing something
> wrong (it's just a HashMap<String, String> that I'm using) or it's not
> possible.

There's always crude debugging right there in the template.  Make sure
that $tags is present and of the expected type first, then be sure the
method call worked.

$tags.class
$tags.get("...")

If all that works in the template, but you still aren't seeing the
result upstream, ping back.

>
> --
> Raymond Augé
> Senior Software Engineer
> Liferay, Inc.
> Enterprise. Open Source. For Life.
>
> --
> Liferay East Coast User Conference 2009
> May 21, 2009
> Reston, Virginia
>
> www.liferay.com/events/ecuc09
>
>
>

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