0

I have a methd in a @Controller, that return the name of the View:

@RequestMapping("/viewNameFiest")
public String methodName(){
       return "viewNameSecond";
}

How can I add a variable to the "return" line? A variable like this return "viewNameSecond/1";

In order to retrieve it with @RequestMapping("/viewNameSecond/{variable}")

Thank you

MDP
  • 4,177
  • 21
  • 63
  • 119

1 Answers1

1

You can redirect:

return "redirect:" + <URL in String>

In your case:

return "redirect:" + "/viewNameSecond/variable"; //create this URL String before return
m.aibin
  • 3,528
  • 4
  • 28
  • 47