Thymeleaf multiple submit button in one form

后端 未结 4 1645
时光说笑
时光说笑 2020-12-03 03:17

I have a fragment of HTML page with one form and 2 button:

4条回答
  •  心在旅途
    2020-12-03 03:23

    You can know which submit button has been clicked and then act upon the button Here is the code

    String btnName = request.getParameter("action");
    
    if(btnName.equals("save"))
        // you code....
    else if(btnName.equals("cancel"))
        // you code....
    

提交回复
热议问题