2 Replies Latest reply on Apr 4, 2006 1:01 PM by m0m0

    Determine current URI from portlet?

    m0m0

      Hello.

      I'm trying to determine which page a portal user is currently on by using the following jsp statements:

      <%
      String currentPage = request.getRequestURI();
      
      if (currentPage.indexOf("News") == -1) {
       ... do some stuff
      } else {
       ... do some other stuff
      }
      %>


      Unfortunately, getRequestURI() returns the page that the portlet is consuming, in this case, /jsp/news.jsp.

      Is there a way that I can determine what the current page is? For the news page, it should be http://host/portal/blah/blah/News. The reason I need this is because I want to reuse my news portlet on multiple pages and display certain information depending on which page the portlet is on.

      Thanks in advance.

        • 1. Re: Determine current URI from portlet?

          you can solve this with either
          * window properties, or
          * portlet preferences

          All it requires you to do is define a new window for each portlet assignment on each page (i.e. for the same portlet on 3 pages, you'll need 3 windows so that you can assign different preferences/window properties).

          • 2. Re: Determine current URI from portlet?
            m0m0

            Thanks for the reponse.

            Can I query the window-name property from JSP? If so, could you provide a quick sample? I'll do some digging on how to do this myself, but I'm fairly new to working with JBoss and portlets for that matter. Thanks again.