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 Ol...@lakeviewtech.com on 2004/07/26 20:26:28 UTC
Action methods obtaining references to the Portlet
Hello -
We have a situation in some of our portlets (using Jetspeed 1.5) where we
wish to place values in the portlet's session within some of our action
methods. We have been using the PortletSessionState helper class to do
this (PortletSessionState.setAttribute(Portlet portlet, RunData rundata,
String attrName, Object attrValue). Since the action methods get
references to only the RunData and Context variables, we need to get the
reference to the Portlet ourselves (via the
PortletAction.getPortlet(Context) method.) Originally, the getPortlet()
method always returned null - which meant we were not able to reliably use
the session in this way. We then changed the form declaration in our
templates from:
<form method="post" action="$jslink.setAction("portlets.FooAction")"> (as
described at: http://portals.apache.org/jetspeed-1/tutorial/7/events.html)
to
<form method="post" action="$jslink"> (as used in some of the samples)
Then this problem went away since we already had the action defined in our
XREG for the portlet (i.e. the getPortlet() method properly returned our
Portlet reference.) My question is, is there any way to get the Portlet
reference with a non-default Action (our original solution?) We currently
have portlets that call off to actions other than those listed as the
default in our XREG files... and we may eventually want to place things in
the portlet's session - can we do this reliably?
Interestingly, I found a very similar thread in the FAQ, but I can't
determine what it really means in terms of explicity setting actions
within the template:
http://portals.apache.org/jetspeed-1/faq.html#Changing_portlet_template
Thanks,
Eric Olson