This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Portals and Portlets and the fly likes show/hide portlet? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "show/hide portlet?" Watch "show/hide portlet?" New topic

show/hide portlet?

pulijala hari
Ranch Hand

Joined: May 14, 2005
Posts: 70

How do I show/hide a portlet in a portal page in Websphere portals.

I have 4 portlet, but, initially the only portlet that should display is just the Welcome page portlet, and the other portlet will only show on the same page when its link has been clicked.

Is there anyway in rules where i can only set a rule like
'Show Portlet when conditon=value otherwise hide' instead of applying whole rule for the entire portal page.

Please help. Thanks.
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

The invisible portlet is actually a pretty tricky thing to implement. I've had a number of customers ask, and have done a few hacks to make it happen. I'm not sure, but I think WebSphere Portal 6 has an invisible feature, but not earlier versions. I haven't seen it, and it may have been a dream, but I thought I saw something about it somewhere.

Anyways, here was one trick I used. It was actually for a portlet that should be invisible unless there was an 'alert'. What we did was we had the portlet output nothing in the view mode unless there was an alert. Then, we applied an invisible skin, where no icons or outlines were used. As a result, the portlet was only visible when there was an alert - other times, the user didn't even know it was there.

It's not exactly what you are asking, but maybe it'll give you some ideas.

You might want to rethink your layout though. That's probably better.

If logging in triggers the other portlets to appear, maybe you should just make it security based. The one portlet has anonymous access, and the others do not have anonymous access. Once a user logs in, the portlets that are on the page, but do not have anonymous access, magically become visible.

Just some ideas for you.

-Cameron McKenzie
pulijala hari
Ranch Hand

Joined: May 14, 2005
Posts: 70
Hi Cameron,

Thank you for the insight.
It will be very nice if you would share the code.
Can we apply different skins to portlets on a single page..
I was only able to apply skins and themes to an entire portal page rather individual portlets on a single portal page?

Please throw some ideas on this.

Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968

Indeed, you can apply different skins to different portlets on a page. There is one however: a theme can define which skins are valid, and for consistency sake, most themes only allow one skin. You have to ensure that multiple skins are allowed for a theme, including the invisible skin.

I apologize for not having the invisible skin. It's at a client site I worked at a few years ago when WebSphere Portal 5.0 was the hot ticket. Someone who develops skins should be able to put one together quickly. It's probably the simplest skin you could do, because there's nothing there.

I still think access restrictions might be the right way to go.

Good luck,

Adrian Enns
Ranch Hand

Joined: Aug 11, 2004
Posts: 48
I know in Weblogic 8.1 you can set "entitlements" of whether a portlet is visible or not by the role of the person who is logged in. Alternatively, I know you can also get access to the "desktop" of the portal application, then get all of the portlets associated with the desktop, and make specific portlets visible/invisible by the name/id of the portlet. Anyways, I'm not sure how this relates to Websphere, but I hope it helped somewhat.
I agree. Here's the link:
subject: show/hide portlet?
Similar Threads
hide a portlet when click on other portlet
Hiding a JBoss portlet
hide portlet using JavaScript developing in NetBeans for JSR 168?
Hide a page/portlet for a user group in WPS 6.0
show/hide portlets in portal