spring mvc: cleanest way for more than one submit button?

前端 未结 2 1016
名媛妹妹
名媛妹妹 2021-02-04 04:03

I have a a form and I\'d like a next and back button inside it. What is the cleanest way to do this in spring mvc? Just give the input type submit a name and value and check for

2条回答
  •  死守一世寂寞
    2021-02-04 04:45

    If you use Spring 3, you can distinguish between controller methods using params attribute:

    
    
    

    .

    @RequestMapping(..., params = "next")
    public ModelAndView next(...) { ... }
    
    @RequestMapping(..., params = "back")
    public ModelAndView back(...) { ... }
    

提交回复
热议问题