You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-user@portals.apache.org by Saddest OfAllKeys <ke...@yahoo.com> on 2002/03/22 00:08:02 UTC
Re: interaction between velocity portlet. (ERRATA)
Previous message should read:
2) The RunData object contains a user, which has a
hashmap. I use the hash map to store data for each
template, hashed by the name of the **PORTLET**.
--- Saddest OfAllKeys <ke...@yahoo.com> wrote:
>
> I'm new at this so caveat emptor.
>
> But I have made progress for what I want to do.
>
> I looked at StockQuoteAction and wanted my own
> action
> (because it seems as though "actions" respond to the
> minimize, maximize, customize buttons).
>
> I am now at a place where I have two different
> portlet-entries which have different customization
> templates and different default values for
> parameters.
>
> My action, "MyAction", derives from
> VelocityPortletAction and exploits the following
> nuggets that I discovered:
>
> 1) It seems that a new MyAction object is created
> each
> time. So member variables won't work.
>
> 2) The RunData object contains a user, which has a
> hashmap. I use the hash map to store data for each
> template, hashed by the name of the template.
>
> So, the first time buildNormalContext() is called, I
> do this:
>
> String pName =
> portlet.getPortletConfig().getName();
>
> and this:
>
> String myParam =
>
portlet.getPortletConfig().getInitParameter(MYPARAM);
>
> Then, I create an object that stores all my
> parameters, and I do a:
>
> myHashMap.put(pName, myParamObject);
> rundata.getUser().setTemp("hashmap", myHashMap);
>
> Later, I can fish out the hash map and look for the
> portlet name.
>
> The basic idea is that you can save state in the
> RunData and Context objects, and fish them out when
> you need them.
>
> The real trick is to call them from a Velocity page:
> to do this, I use a callback mechanism. So, I put
> the
> hashMap and the portletName into the Context and the
>
> Velocity page is something like:
>
> $myObject.myPublicMethod( $hashMap, $portletName);
>
> In this way, myPublicMethod() can figure out what
> state it should be using.
>
> Again, it seems to work for me, but I have no idea
> if
> there is a better way. I would love comments.
>
> Mike
> keyofdminor@yahoo.com
>
>
> --- Pierre BESNARD <pb...@odaxys.fr> wrote:
> > Hi,
> >
> > I have 2 velocity portlet A & B on the same
> screen.
> > The first one, A, uses 2 different templates T1 &
> > T2.
> > The default template (defined in the registry
> file)
> > is T1.
> > The current diplayed template is T2.
> > When I play with the portlet B, the Template T1 of
> > the portlet A comes back !
> > So the question is: how can i modify my portlet A,
> > so that it keeps its current template displayed
> when
> > i use another portlet?
> > I know that the buildNormalContext(p,c,r) method
> of
> > AAction is called but i don't know how to use it!
> >
> > thanks in advance
> > --
> > Pierre
> >
> >
> > --
> > To unsubscribe, e-mail:
> >
>
<ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Movies - coverage of the 74th Academy Awards�
> http://movies.yahoo.com/
>
> --
> To unsubscribe, e-mail:
>
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards�
http://movies.yahoo.com/
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>