Two Laptop Bag*
The moose likes Portals and Portlets and the fly likes show/hide portlets in portal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Portals and Portlets
Bookmark "show/hide portlets in portal" Watch "show/hide portlets in portal" New topic
Author

show/hide portlets in portal

navat venu
Ranch Hand

Joined: May 14, 2006
Posts: 66
how to show/hide(personalise) portlets in portal page?

In my portal page there are two portlets.Initially when portal page loads only portlet should appear. when i click some button in first portlet , the second portlet should show up in the portal page?

Please clarify !!
[ September 01, 2006: Message edited by: Bear Bibeault ]

-------------------- <br />SCJP 1.4<br />SCWCD 1.4<br />SCBCD 5(in progress)<br /> <br />"Do, what you think that you cannot do"
Cameron Wallace McKenzie
author and cow tipper
Saloon Keeper

Joined: Aug 26, 2006
Posts: 4968
    
    1

Wow Dude. You have no idea how big a question you just asked!

To answer you're question, it'd be great if we knew why you were doing this, as opposed to how. Why two portlets? Can your objective be achieved with just one. For the second portlet, is there anything that can be displayed before the first portlet has interacted with it?

If the question is about inter-portlet communication, then there are a few approaches. Jetspeed allows portlet messaging, JSR-168 provides a shared PortletSession, which might be helpful, and WebSphere Portal Server provides C2A, or click-to-action, which is great for interportlet communication.

But that assumes your challenge is inter-portlet communication. I think your challenge is hiding a portlet on a page. That now goes to skins and themes, which is a whole other ball of was, and is very difficult to control with a Portlet.

One trick I used when I wanted an 'alert' portlet on a page, was to create a n inivisible skin, and render no content in the alert portlet. It would be inisible on the page unless we delivered alert content. It was a big of a hack, but it worked.

One challenge with working with Portal is seeing your applications as portlet, and not simply Struts or Servlet applications running inside of a Portlet window. The Portal requires a complete mind-shift in delivering applications. It's a tough shift to make, but when you make it, envisioning your applications becomes easier.

By the way, I've got a bunch of free multimedia tutorials about developing Portlets on my website. Check them out if you're new to developing JSR-168 Portlets, especially if you're using WebSphere 5.0 or 5.1.

http://www.technicalfacilitation.com/examscam/get.php?link=../portal/tutorials

Cheers!

-Cameron
navat venu
Ranch Hand

Joined: May 14, 2006
Posts: 66
Hi kameron,

Thanks a lot for the reply.

I got the anwer to the question i raised .
I will explain again the problem and answer as how i achieved it.

Question:
--------------------------------------------------------------------------
In my case,I have a portal page.And two portlets on it.The first portlet is
a search window.When i give some search info and press search button,the the second portlet which is hiding should appear with search results.
--------------------------------------------------------------------------

Answer:
--------------------------------------------------------------------------
The concept i used is "backing file".This file is simply a java file.
If we attach this backing file to the second portlet.Then before rendering the second portlet, the java file is executed.In the java file as per the value set by first portlet,i can make the second portlet show or hide.
-------------------------------------------------------------------------
I am using weblogic portal8.1 SP5.

the backing file i used is :

------------------------------------------------------------------------
public class MyBackingFile extends AbstractJspBacking
{

public boolean preRender(HttpServletRequest request, HttpServletResponse response)
{
PortletBackingContext context = PortletBackingContext.getPortletBackingContext(request);
System.out.println("**inside backing file**");

if(request.getSession().getAttribute("NAVIGATION_KEY") == null)
{
context.setVisible(false);
}
else {
context.setVisible(true);
return true;
}


return false;
}
}

------------------------------------------------------------------------
I am new to the portal development,but i m a quick learner.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: show/hide portlets in portal