Announcement Announcement Module
No announcement yet.
Methods not being called in a Spring MVC Portlet Form Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Methods not being called in a Spring MVC Portlet Form

    I have a form in a portlet which has the ACTION defined by this variable:

    <portlet:actionURL var="action">
    <portletaram name="action" value="xxx"/>
    <portletaram name="event" value="yyy"/>

    However, the only method in my SimpleFormController which ever gets called is showForm(), despite the fact that I'm calling an actionURL.

    Can anyone help me understand why none of the form submission or action methods are being called?


  • #2

    I am havin the same issue. What steps did you take to resolve this issue.

    Thanks in advance.


    • #3
      You must annotate your Controller's methods with @ActionMapping/@RenderMapping tags in the way it follows

      public class MyController {
      	public void actionDispatcher(@RequestParam("action") String action, 
      								 @ModelAttribute("estadoPedido") EstadoPedidoForm form,
      								 BindingResult bindingResult, Model model,
      								 ActionRequest aRequest, ActionResponse aResponse){
      //your code goes here
      	public String renderDispatcher(@RequestParam("action") String action){
      		String retorno = null;
      		if (action.equals("consultar") || action.equals("return")){
      			retorno = "consultaPedido";
      		}else if(action.equals("irDetallePedido")){
      			retorno = "detallePedido";
      		}else if (action.equals("noDisponible")) {
      			retorno = "noDisponible";
      		}else if(action.equals("error")){
      			retorno = "error";
      		return retorno;
      No matters your method's names, they will be executed when a Action/Render request is recived and matches with their requirements (i.e. request with a param called "action", or it could be more restrictive: a param called action which value is "doSomething"... etc)
      in this example, both methods acts as dispatchers, doing one or another thing depending on the action parameter value.

      Here you are 2 very instructive links:

      I hope it could helps you some.