Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Custom MVCAction Command for Out of box portlet
			Hi All,We are working on staging portlet.As per our requirement we need to create one JSP page and perform action on the same .1> I have created Fragment for customizing jsp then added one additional jsp for our requirement
2> now i need to create mvc action command - i have created custom module and added one action command - at component level i changed portlet name to required one .But still the action is not getting invoked - Please help me on this.Thanks
Bharamani
		2> now i need to create mvc action command - i have created custom module and added one action command - at component level i changed portlet name to required one .But still the action is not getting invoked - Please help me on this.Thanks
Bharamani
Bharamani Tashildar:
Can you share (simplified) code?
... I have created custom module and added one action command - at component level i changed portlet name to required one .But still the action is not getting invoked - Please help me on this.
			Hi1> first i created fragment hook for staging bar portlet and customized view_layout_revision_details.jsp.
2> I have created separate module and added below mvc command.
@Component(
property = {
"javax.portlet.name=com_liferay_staging_bar_web_portlet_StagingBarPortlet",
"mvc.command.name=addNoteURL"
},
service = MVCActionCommand.class
)
public class AddNoteForPublishMVCActionCommand extends BaseMVCActionCommand { private static final Log _log = LogFactoryUtil.getLog(AddNoteForPublishMVCActionCommand.class.getName()); @Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
        
_log.info("Action Calling..............HRRP Instance URL");
        
String note = ParamUtil.getString(actionRequest, "note");
        
_log.info("note:- " + note);}}
Thanks
		2> I have created separate module and added below mvc command.
@Component(
property = {
"javax.portlet.name=com_liferay_staging_bar_web_portlet_StagingBarPortlet",
"mvc.command.name=addNoteURL"
},
service = MVCActionCommand.class
)
public class AddNoteForPublishMVCActionCommand extends BaseMVCActionCommand { private static final Log _log = LogFactoryUtil.getLog(AddNoteForPublishMVCActionCommand.class.getName()); @Override
protected void doProcessAction(ActionRequest actionRequest, ActionResponse actionResponse) throws Exception {
_log.info("Action Calling..............HRRP Instance URL");
String note = ParamUtil.getString(actionRequest, "note");
_log.info("note:- " + note);}}
Thanks
			Here, just in case you haven't seen the docs on MVC Action Command overrides.
https://portal.liferay.dev/docs/7-2/customization/-/knowledge_base/c/overriding-mvcactioncommand
As a shot in the dark, you might need to give your service component a higher ranking.
		https://portal.liferay.dev/docs/7-2/customization/-/knowledge_base/c/overriding-mvcactioncommand
As a shot in the dark, you might need to give your service component a higher ranking.
			Hi Russell,
I am not overriding any mvccommand.
I have to write new mvcaction command for one of the out of box portlet.
Thanks
		I am not overriding any mvccommand.
I have to write new mvcaction command for one of the out of box portlet.
Thanks
			Ahh, sorry, I missed that.
We also have an article on adding logic to existing MVC commands, not sure if you could use that to your advantage, invoking your custom logic during the regular processing of an existing MVC command: https://portal.liferay.dev/docs/7-2/customization/-/knowledge_base/c/adding-logic-to-mvc-commands
		We also have an article on adding logic to existing MVC commands, not sure if you could use that to your advantage, invoking your custom logic during the regular processing of an existing MVC command: https://portal.liferay.dev/docs/7-2/customization/-/knowledge_base/c/adding-logic-to-mvc-commands
			What's the actionURL being invoked look like? Make sure it matches everything. Another thing to check is whether your MVC class is active (you can check in the gogo shell).