I use IPortletURL Java Object to redirect and call a Action in target portlet,but failed.
Please help me to analysis the trouble…
in the souce porlet binding the following action to a command button control
public void htmlCommandButton_action() throws Exception{
IPortletURL refreshUrl = createActionUrl();
refreshUrl.clearParameters();
refreshUrl.clearState();
refreshUrl.setPortlet("/meta/default/link_portlet___targetpage/0000010988");
refreshUrl.setTargetAction("dammit");
Debug.info("redirectURL : " + refreshUrl.toString());
getFacesContext().getExternalContext().redirect(refreshUrl.toString());
}
the dammit action is in the target portlet
@PortletAction
public void dammit()
{
Debug.info("dammit");
}
but but when I click the Command Button , the page was not redirect,but the target action was be executed.
I check the message in full_log
[2013-04-27 23:52:18 CST (Framework:INFO) [RID:201] - redirectURL : /meta/default/link_portlet___sourcepage/0000010984?wmp_tc=10988&wmp_rt=action&wmp_ax=KkLTrr31MH4oUXW6Qhp5DYlDIWQ%3d&wmp_ta=dammit
2013-04-27 23:52:18 CST (Framework:INFO) [RID:202] - Processing request [1j9cmt549q386:Administrator] http://localhost:8585/meta/default/link_portlet___sourcepage/0000010984 (GET)
2013-04-27 23:52:18 CST (Framework:INFO) [RID:202] - dammit ]
it shows that the target Action was be called successfull,but the page was still stay in source portlet,redirect failed!
To solve the problem,I modify the code
public void htmlCommandButton_action() throws Exception{
IPortletURL refreshUrl = createActionUrl();
refreshUrl.clearParameters();
refreshUrl.clearState();
//refreshUrl.setPortlet("/meta/default/link_portlet___targetpage/0000010988");
refreshUrl.setBaseURL("/meta/default/link_portlet___targetpage/0000010988");
refreshUrl.setTargetAction("dammit");
Debug.info("redirectURL : " + refreshUrl.toString());
getFacesContext().getExternalContext().redirect(refreshUrl.toString());
}
when i click the command button , the portlet redirect to the target portlet Successfully,but the action on target portlet called failed.
i check the full_log
[2013-04-28 00:14:16 CST (Framework:INFO) [RID:207] - redirectURL : /meta/default/link_portlet___targetpage/0000010988?wmp_tc=10984&wmp_rt=action&wmp_ax=KkLTrr31MH4oUXW6Qhp5DYlDIWQ%3d&wmp_ta=dammit
2013-04-28 00:14:16 CST (Framework:INFO) [RID:208] - Processing request [1j9cmt549q386:Administrator] http://localhost:8585/meta/default/link_portlet___targetpage/0000010988 (GET)
2013-04-28 00:14:16 CST (jsf:INFO) [RID:208] - [POP.016.0048] ???: ????dammit ]
the Chinese means invalid target Action
Let’s analysis together,and help me to solve the problem
thanks very much!
link_Portlet.zip (12.8 KB)