Announcement Announcement Module
Collapse
No announcement yet.
PortletMVC : Invalid action method return value: ModelAndView: reference to view... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • PortletMVC : Invalid action method return value: ModelAndView: reference to view...

    Hi,

    I'm trying to use portlet MVC annotation based, but I get some trouble if I want to use @ActionMapping !
    in my jsp I've got :
    Code:
    ...
    <portlet:defineObjects/>
    <portlet:actionURL name="showClientForm" var="clientFormUrl"/>
    
    <a href="${clientFormUrl}">add client</a>
    ...
    In my controller :
    Code:
    ...
            @ActionMapping("showClientForm")
    	public String goToForm(Model model) {
    		log.info("method goToForm");
    		model.addAttribute("client", new ClientImpl());
    		return "formClient";
    	}
    When I click on the link from the jsp, goToForm method is called, but it fail to show the view with the following error :
    Code:
    16:03:15,751 ERROR [DispatcherPortlet:559] Could not complete request
    java.lang.IllegalStateException: Invalid action method return value: ModelAndView: reference to view with name 'formClient'; model is {client={clientId=0, companyId=0, userId=0, userName=, createDate=null, modifiedDate=null, firstName=, lastName=}, org.springframework.validation.BindingResult.client=org.springframework.validation.BeanPropertyBindingResult: 0 errors}
    	at org.springframework.web.portlet.mvc.annotation.AnnotationMethodHandlerAdapter.handleAction(AnnotationMethodHandlerAdapter.java:282)
    	at org.springframework.web.portlet.DispatcherPortlet.doActionService(DispatcherPortlet.java:641)
    	at org.springframework.web.portlet.FrameworkPortlet.processRequest(FrameworkPortlet.java:519)
    	at org.springframework.web.portlet.FrameworkPortlet.processAction(FrameworkPortlet.java:460)
    	at com.liferay.portlet.FilterChainImpl.doFilter(FilterChainImpl.java:70)
    	at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:48)
    	at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:92)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    ...
    How to solve that ?

    I'm using Liferay 6.0.6 and my application is deployed with the plugin SDK.

    Regards

  • #2
    try doing this....


    in your jsp :

    <portlet:defineObjects/>
    <portlet:actionURL var="clientFormUrl"/>
    <portletaram name="next" value="nextPage" />
    </portlet:actionURL>
    <a href="${clientFormUrl}">add client</a>

    In your controller :

    @ActionMapping(params="next=nextPage")
    public void goToForm(ActionRequest request, ActionResponse response) {
    log.info("method goToForm");
    response.setRenderParameter("next","nextPage");
    }

    @RenderMapping(params = "next=nextPage")
    public String myMethod(RenderResponse response, Map<String, Object> model) {

    return "your jsp page name";

    }

    Comment

    Working...
    X