[jboss-user] [JBoss Portal] - Re: Link from the body of a portlet to a portlet on another

vietanh.vu do-not-reply at jboss.com
Fri Nov 3 01:48:05 EST 2006


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/

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3982863#3982863

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3982863



More information about the jboss-user mailing list