Custom MVCAction Command for Out of box portlet

Bharamani Tashildar, modified 5 Years ago. New Member Posts: 10 Join Date: 10/30/19 Recent Posts
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
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Bharamani Tashildar:

... 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.
Can you share (simplified) code?
Bharamani Tashildar, modified 5 Years ago. New Member Posts: 10 Join Date: 10/30/19 Recent Posts
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 
thumbnail
Russell Bohl, modified 5 Years ago. Expert Posts: 308 Join Date: 2/13/13 Recent Posts
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.
Bharamani Tashildar, modified 5 Years ago. New Member Posts: 10 Join Date: 10/30/19 Recent Posts
Hi Russell,
I am not overriding any mvccommand.
I have to write new mvcaction command for one of the out of box portlet.
Thanks 
thumbnail
Russell Bohl, modified 5 Years ago. Expert Posts: 308 Join Date: 2/13/13 Recent Posts
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
thumbnail
Amos Fong, modified 5 Years ago. Liferay Legend Posts: 2047 Join Date: 10/7/08 Recent Posts
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).