portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Sean Taylor <da...@bluesunrise.com>
Subject Re: Show or Hide portlets on a page dynamically
Date Mon, 23 Apr 2007 14:04:43 GMT

On Apr 22, 2007, at 9:40 PM, Sie, Yang wrote:

> Hello all:
> Please advise on what I am trying to achieve...
> On my psml, I have 5 portlets, one of them is the master one  
> (portlet0),
> which contains two image buttons. Depends on which button I am  
> clicking,
> I want to hide or show the first 2 portlets (i.e. Click button_1, I  
> want
> portletA and portletB to show, portletC and portletD are hidden  
> from the
> user. Click button_2, portletC and portletD are showing and  
> portletA and
> portletB disappear). The master portlet portlet0 is always on the  
> page.
> What came to my mind was to customize the aggregator to selectively
> render the portlets that I need. However, I hit some problems when  
> doing
> so:

The first thing that came to my mind is to use Javascript to hide the  
You can get the DIV for each portlet from its window id:

<div id="dp-7" class="portlet tigris">

> From JetspeedRequestContext, I can get the current page, then I try to
> 'remove' the unwanted portlets from the ContentFragment List  
> depends on
> which button I click. Then the all the portlets remained on the  
> page go
> to the render engine.

Sounds like this could work too....

> What I wanted was that all five portlets should be available for
> evaluation each time a request is sent to server. This is not the  
> case.
> The problem was that for those portlets been "removed", they were no
> longer available for next time evaluation. They are wiped out from the
> cache or persistent store (i.e. I clicked the second button, which was
> supposed to evaluate all five portlets again to see which ones to  
> keep,
> but it did not happen (only portlets left from the first time click  
> were
> available in the ContentPage object)). Close and re-start browser  
> didn't
> make them come back. I am sure that no portlet was deleted from the  
> psml
> (when I started Tomcat again, all five portlets were available again)
> and PSML page wasn't updated.
> The problem is that I was unable to find a way to refresh the page
> object to make it contain all five portlets each time I send a new
> request to server (i.e. after I navigate from the other page or click
> the second button).  I tried to use pageManager to get the page (psml)
> again and re-assign the page to JetspeedRequestContext. Did not work.
> The page that I got thru pageManager still didn't have all the  
> portlets
> on it.
> What is the best suggestion to this issue.  Please help...

I would consider cloning the page in a new valve that you add in  
after the profiler valve
This valve would do two things:

1. clone the page by calling pageManager.copyPage(source, "/temp/ 
2. wrapper the Page with a ContentPage contentPage
3. replace that page in the request Context by calling  

To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org

View raw message