Search code examples
javaliferay-7

How to redirect from ActionMapping to determined RenderMapping


I need to call determined renderMapping method from actionMapping Code:

@ActionMapping(value = "update")
    public String update(ActionRequest request, ActionResponse response) {
        return "update";//how to call method update that is below instead of view method
    }

@RenderMapping(value = "update")
    public String update(RenderRequest request, RenderResponse response) {
                return "updateForm";
    }
@RenderMapping()
        public String view(RenderRequest request, RenderResponse response) {
            return forward;
        }

Solution

  • You can set the view to be rendered (call a render method) at your actionMapping method as following:

    response.getRenderParameters().setValue("view", "myView");

    myView should be the view you want to display. That will call the render method mapping "myView".

    By the way, I'm pretty sure you put a wrong tag on your question. That would concern Liferay 6.x not liferay 7 :-)

    cheers.