3 Replies Latest reply on Nov 3, 2006 1:48 AM by vietanh.vu

    Link from the body of a portlet to a portlet on another page

      I need to put links in the body of a portlet on page A that links to a different portlet on page B. I also need to be able to pass parameters to the portlet on page be telling it how to render.

      Is there a way to do this ? RenderURLs adn ActionURLs only generate URLs to the current portlet.

      Is there a JSP Custom Tag that would take a page name, portlet name, and a list of param/value pairs and generate a portal specific render URL ?

      Maybe like this ?






      would generate a link that looks like this

      http://localhost/portal/index.html?ctrl:cmd=render&ctrl:window=myportal.mypage.myportlet&param1=val1&param2=val2

        • 1. Re: Link from the body of a portlet to a portlet on another
          theute

          There is no way to do it that follows the specification.

          But in JBoss Portal, you can navigate in the tree of portal instances / pages / windows and achieve what you are looking for, look at the IPC documentation

          • 2. Re: Link from the body of a portlet to a portlet on another
            vietanh.vu

            Actually, there is a JSR168-compliant way to do this, with the help of javascript

            at portlet ABC , I include a hidden form similar to this

            <form id="portletABCForm" action="<portlet:actionURL/>" method="post" style="display:none">
            </form>


            Note that the form id is porletABCForm to indicate that it belongs to portlet ABC,
            I also create a javascript function

            function invokeActionURLPortlet(portletName) {
            var frm = document.getElementById("portlet" + portletName + "Form");
            if (frm) {
            var frmHtml = frm.innerHTML;
            for (var i = 1; i < arguments.length - 1; i+=2) {
            var parameterName = arguments;
             var parameterValue = arguments[i + 1];
             frmHtml += "<input type=\"hidden\" name=\"" + parameterName + "\" value=\"" + parameterValue + "\"/>";
             }
             frm.innerHTML = frmHtml;
             frm.submit();
             }
             }



            Now, I can invoke the actionURL of portlet ABC by using the above function
            <a href="javascript:invokeActionURLPortlet("ABC", "param1" , "value1", "param2", "value2")">Click here to invoke portlet ABC action URL with param1=value1&param2=value2</a>


            The solution is also posted my blog at http://vpensieve.blogspot.com/

            • 3. Re: Link from the body of a portlet to a portlet on another
              vietanh.vu

              Actually, there is a JSR168-compliant way to do this, with the help of javascript

              at portlet ABC , I include a hidden form similar to this

              <form id="portletABCForm" action="<portlet:actionURL/>" method="post" style="display:none">
              </form>


              Note that the form id is porletABCForm to indicate that it belongs to portlet ABC,
              I also create a javascript function

              function invokeActionURLPortlet(portletName) {
              var frm = document.getElementById("portlet" + portletName + "Form");
              if (frm) {
              var frmHtml = frm.innerHTML;
              for (var i = 1; i < arguments.length - 1; i+=2) {
              var parameterName = arguments;
               var parameterValue = arguments[i + 1];
               frmHtml += "<input type=\"hidden\" name=\"" + parameterName + "\" value=\"" + parameterValue + "\"/>";
               }
               frm.innerHTML = frmHtml;
               frm.submit();
               }
               }



              Now, I can invoke the actionURL of portlet ABC by using the above function
              <a href="javascript:invokeActionURLPortlet("ABC", "param1" , "value1", "param2", "value2")">Click here to invoke portlet ABC action URL with param1=value1&param2=value2</a>


              The solution is also posted my blog at http://vpensieve.blogspot.com/