Re: Portlets - Loosing state in wicket portlets

2009-05-22 Thread sauli_k

You could try setting 
layout.default.p_l_reset=false 

to portal-ext.properties and see if it helps keeping the state of the
portlets. 
(http://www.liferay.com/web/guest/community/forums/-/message_boards/message/2190331#_19_message_2214544)



Benjamin Ernst wrote:
 
 Hi,
 
 I am using two Wicket-Portlets in a Liferay 5.2.1 Portal. Both Portlets
 have
 a link which switches to another page within the portlet (via
 setResponsepage(new
 Page()) ).
 When I click the link in Portlet_1 the page within the portlet one changes
 as desired. After that I click the link in Portlet_2 and the page in
 Portlet_2 changes as desired, but i Portlet_1 the page changes to the
 Homepage.
 
 I think that the problem might be in the getWicketURL(PortletRequest
 request, String pageType, String defaultPage) - method form
 WicketPortlet.java:
 
 protected String getWicketURL(PortletRequest request, String pageType,
 String defaultPage)
 {
 String wicketURL = null;
 // get the name of the wicket url paramater, as looked up from a
 request attribute called
 // WicketPortlet#WICKET_URL_PORTLET_PARAMETER_ATTR
 String wicketUrlParameterName =
 (String)request.getAttribute(WicketPortlet.WICKET_URL_PORTLET_PARAMETER_ATTR);
 if (request instanceof ActionRequest)
 {
 // try to lookup the passed in wicket url parameter
 wicketURL = request.getParameter(wicketUrlParameterName);
 }
 else if (request instanceof ResourceRequest)
 {
 wicketURL = ((ResourceRequest)request).getResourceID();
 }
 else
 {
 // try to lookup the passed in wicket url parameter, suffixed
 with the portlet mode
 String parameterName = wicketUrlParameterName +
 request.getPortletMode().toString();
 wicketURL = request.getParameter(parameterName);
 }
 
 // if the wicketURL could not be retrieved, return the url for the
 default page
 if (wicketURL == null)
 {
 wicketURL = getWicketConfigParameter(request,
 CONFIG_PARAM_PREFIX + pageType,
 defaultPage);
 }
 return wicketURL;
 }
 
  - In the RenderRequest for Portlet_2 the wicketUrlParameterName is for
 the
 Linklistener that was clicked. This works fine.
  - In the RenderRequest for Portlet_1 the wicketUrlParameterName is null.
 So
 by default the defaultPage of Portlet_1 is loaded, which is the Homepage.
 
 Is this the correct behaviour?
 I think the wicketURL for the RenderRequest for Portlet_1 should not be
 the
 defaultPage but instead the last rendered Page from Portlet_1. Is there a
 way to get the URL of the last page from Wicket?
 
 Thanks for any help!
 
 --Benjamin
 
 

-- 
View this message in context: 
http://www.nabble.com/Portlets---Loosing-state-in-wicket-portlets-tp22431482p23668875.html
Sent from the Wicket - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



Portlets - Loosing state in wicket portlets

2009-03-10 Thread Benjamin Ernst
Hi,

I am using two Wicket-Portlets in a Liferay 5.2.1 Portal. Both Portlets have
a link which switches to another page within the portlet (via
setResponsepage(new
Page()) ).
When I click the link in Portlet_1 the page within the portlet one changes
as desired. After that I click the link in Portlet_2 and the page in
Portlet_2 changes as desired, but i Portlet_1 the page changes to the
Homepage.

I think that the problem might be in the getWicketURL(PortletRequest
request, String pageType, String defaultPage) - method form
WicketPortlet.java:

protected String getWicketURL(PortletRequest request, String pageType,
String defaultPage)
{
String wicketURL = null;
// get the name of the wicket url paramater, as looked up from a
request attribute called
// WicketPortlet#WICKET_URL_PORTLET_PARAMETER_ATTR
String wicketUrlParameterName =
(String)request.getAttribute(WicketPortlet.WICKET_URL_PORTLET_PARAMETER_ATTR);
if (request instanceof ActionRequest)
{
// try to lookup the passed in wicket url parameter
wicketURL = request.getParameter(wicketUrlParameterName);
}
else if (request instanceof ResourceRequest)
{
wicketURL = ((ResourceRequest)request).getResourceID();
}
else
{
// try to lookup the passed in wicket url parameter, suffixed
with the portlet mode
String parameterName = wicketUrlParameterName +
request.getPortletMode().toString();
wicketURL = request.getParameter(parameterName);
}

// if the wicketURL could not be retrieved, return the url for the
default page
if (wicketURL == null)
{
wicketURL = getWicketConfigParameter(request,
CONFIG_PARAM_PREFIX + pageType,
defaultPage);
}
return wicketURL;
}

 - In the RenderRequest for Portlet_2 the wicketUrlParameterName is for the
Linklistener that was clicked. This works fine.
 - In the RenderRequest for Portlet_1 the wicketUrlParameterName is null. So
by default the defaultPage of Portlet_1 is loaded, which is the Homepage.

Is this the correct behaviour?
I think the wicketURL for the RenderRequest for Portlet_1 should not be the
defaultPage but instead the last rendered Page from Portlet_1. Is there a
way to get the URL of the last page from Wicket?

Thanks for any help!

--Benjamin