Forum Stats

  • 3,825,283 Users
  • 2,260,497 Discussions


Getting the portlet URL from the portal

user10739870 Member Posts: 10
edited Jan 16, 2009 4:48AM in WebLogic Portal
Hi All,

I have Language Header links (eg English,German, French) in my header.jsp which is under skeletons folder in my consumer which is the portal.
When I click on any of the link , I would like to stay on the same page of the portlet that can be remote and from any other producer and the text would be displayed with new language.
I am facing the issue of how to get the current context of the portlet in the portal and redirect to the same context from the portal.
Can anyone of you please tell the solution of the problem ?

Many Thanks in advance


  • 667822
    667822 Member Posts: 36

    Here is a way to do this. Implement a portlet backing file (extends AbstractJspBacking) and do something like this in the handlePostbackData() method:

    public boolean handlePostbackData(HttpServletRequest request, HttpServletResponse response) {
    if (isRequestTargeted(request)) {

    // TODO decide if the user has changed the language

    if (changeLanguage) {
    // TODO change the language for the user, maybe using the LocaleProvider facility of WLP

    // now, tell the portal to redirect back to this page
    PageURL url = PageURL.createPageURL(request, response);

    // make sure the URL uses the proper ampersands...
    // ...and is encoded with a session token if necessary
    String redirectUrl = response.encodeRedirectURL(url.toString());

    PortletBackingContext pbc = PortletBackingContext.getPortletBackingContext(request);
    return super.handlePostbackData(request, response);
  • 667822
    667822 Member Posts: 36
    The code in my previous post assumes your header links are within a portlet. Portlets can live inside the header, so I would suggest implementing your header as a portlet instead of modifying the skeleton file.

    To add a portlet to the header:

    1. Using the Merged Resource view in Workshop, find the .shell file you are using under /framework/markup/shells
    2. Right click and Copy to Project
    3. Using the Project Navigator, double click on the .shell to open the shell editor
    4. Right click on the "header" box, and select a layout
    5. Drag and drop your portlet onto the box
    6. If any .portal file references the shell, you must "reload" the shell using each .portal's property editor (reload button in the shell field)
  • Hi Peter,

    Thanks for your reply.

    I got your point , But in my case when I will include the header in a portlet that request will be available only in that portlet's backing file . So when I click on header language link , the request will not be going to the porltet which is currently displayed . This portlet can be remote.So the language locale will not be propagated to the remote portlet.

    Looking forward to your response.

This discussion has been closed.