jQuery in Action
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Portals and Portlets
 
RSS feed
 
New topic
Author

How to clear portlet cache?

Vadim Vararu
Ranch Hand

Joined: Jan 03, 2009
Messages: 120

I load portlets with a menu. When i push on a menu item one portlet loads. When i push on other menu item, other portlet loads.

The problem is the next one:
I load a portlet and navigate through it, so i load diferent pages inside that portlet. When i push on the menu (the same item) the portlet keeps in cache last url loaded, but i need the initial page. How is it possible to implement that?

If you think you've done too much, usually it means you've done too few.
bharath sadanagiri
Greenhorn

Joined: Feb 04, 2010
Messages: 4

Even I have facing the same problem.
In my jboss portal I have different Tabs like Home,Reports and apps. I clicked on Home tab first, all the portlets in Home tab got loaded and did some operations in all the portlets. So resultant portlets displayed in the Home page. After that I moved to reports tab and did some operations on all the report portlets. So resultant portlets displayed in the Reports page. I navigated between all the tabs but the last resultant portlets are still getting displayed.
So my question is: Is there any configuaration like Expiration-Cache tag to display the default pages when the tab is clicked?
bharath sadanagiri
Greenhorn

Joined: Feb 04, 2010
Messages: 4

bharath sadanagiri wrote:Even I am facing the same problem.
In my jboss portal I have different Tabs like Home,Reports and apps. I clicked on Home tab first, all the portlets in Home tab got loaded and did some operations in all the portlets. So resultant portlets displayed in the Home page. After that I moved to reports tab and did some operations on all the report portlets. So resultant portlets displayed in the Reports page. I navigated between all the tabs but the last resultant portlets are still getting displayed.
So my question is: Is there any configuaration like Expiration-Cache tag to display the default pages when the tab is clicked?
Tim McGuire
Ranch Hand

Joined: Apr 30, 2003
Messages: 428

What do you have expiration-cache set to now?

in each portlet.xml should make them show initial state
bharath sadanagiri
Greenhorn

Joined: Feb 04, 2010
Messages: 4

Already, for all the portlets it is mentioned like
<expiration-cache>0</expiration-cache>

but still no use
bharath sadanagiri
Greenhorn

Joined: Feb 04, 2010
Messages: 4

Hi,
I got the answer from the following site.

Once ActionResponse.setRenderParameter () is called, parameter will be available between all sub sequent requests.
http://portals.apache.org/pluto/portlet-1.0-apidocs/javax/portlet/ActionResponse.html

This link https://www.ibm.com/developerworks/mydeveloperworks/blogs/Joey_Bernal/entry/refreshing_a_portlet_on_the?lang=en
provides a solution. It says instead of setting parameters in renderRequest object in processAction (), set it in session, once used in JSP, remove from session. In this way, you can solve this problem. Move all parameters to session and remove it as soon as you have used in page.

In my case, I moved the navagation key like actionCommand to session and removed in the doView method itself. Please find the piece of code.
in doView() method
============
PortletSession ps = req.getPortletSession();
String actionCommand= (String)ps.getAttribute("actionCommand");
if( ( actionCommand!=null && actionCommand.length()>0 )&& actionCommand.equals("displayCompanyUserReport")){
LOG.debug("Forwarding the request to DisplayCompanyUserReport.jsp for the default functionality");
prd = getPortletContext().getRequestDispatcher("/view/DisplayCompanyUserReport.jsp");
ps.removeAttribute("actionCommand");
LOG.debug("Removed actionCommand from the session");
}
in processAction() method
=================
String actionCommand= req.getParameter("actionCommand");
if( ( actionCommand!=null && actionCommand.length()>0 )&& actionCommand.equals("displayCompanyUserReport")){
res.setRenderParameter("companyId", req.getParameter("companyId"));
res.setRenderParameter("actionCommand", "dummy");
session.setAttribute("actionCommand", "displayCompanyUserReport");
}

Regards,
Jayabharath
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Portals and Portlets
 
RSS feed
 
New topic
hibernate profiler

.