You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pluto-dev@portals.apache.org by Eric Chow <er...@gmail.com> on 2008/07/04 11:26:15 UTC
Pluto-2.0 portletSession cannot share parameters !!!
Hello,
I am testing the Pluto-2.0. I could not retrieve the attributes from
PortletSession.
For example,
I use portletSession.setAttribute("MYVAR", "some value") in PortletA,
and retrieve it in PortletB, but it always returned "null".
I tried to add the following in the portlet.xml in application level.
<container-runtime-option>
<name>javax.portlet.actionScopedRequestAttributes</name>
<value>true</value>
<value>numberOfCachedScopes</value>
<value>10</value>
</container-runtime-option>
Is there any bug ?
Best regards,
Eric
-----------
public class HelloWorldPortlet extends GenericPortlet {
public static final String VIEW_PAGE = "/WEB-INF/portlets/demo/view.jsp";
public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
// -------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------- retrieve the
attribute from the portlet session
// -------------------------------------------always
return NULL ------------------------------------------------------------------------------
System.out.println("......................" +
request.getPortletSession().getAttribute("MYVAR"));
response.setContentType("text/html");
PortletContext context = getPortletContext();
PortletRequestDispatcher requestDispatcher =
context.getRequestDispatcher(VIEW_PAGE);
requestDispatcher.include(request, response);
}
}
------------------
public class LocalePortlet extends GenericPortlet {
private static final String VIEW_PAGE =
"/WEB-INF/portlets/framework/locale/view.jsp";
private Log log = LogFactory.getLog(this.getClass());
public void doView(RenderRequest request, RenderResponse response)
throws PortletException, IOException {
response.setContentType("text/html");
PortletContext context = getPortletContext();
PortletRequestDispatcher requestDispatcher = context
.getRequestDispatcher(VIEW_PAGE);
requestDispatcher.include(request, response);
}
public void processAction(ActionRequest request, ActionResponse response)
throws PortletException, IOException {
//
-------------------------------------------------------------------------------------------------------------------------
// ------------------------------------------- set attribute to
portlet session
//
-------------------------------------------------------------------------------------------------------------------------
request.getPortletSession().setAttribute("MYVAR", "This is my variable");
}
}