Wednesday, October 23, 2013

Spring forward to another controller

I use the following approach in my spring applicaitons whenever I need to forward the request from one controller to another controller


@RequestMappping({"/MyURL"})

public String execute(Model model){
   if(){
       //Do Something
      return "forward:/URLNO1"
   } else {
      //Do Something
      return "forward:/URLNO2"
   }

}


As recomended in the below stackoverflow thread

http://stackoverflow.com/questions/7366170/spring-3-0-forwarding-request-to-different-controller/7366199#7366199
 

No comments:

Post a Comment