Spring MVC. Invoke Controller from view -


how call method in controller view (html) ? how without javascript? if use tag:

 <form action="btn1" method="post">         <button class="btn"> test 1 </button>  </form> 

the controller called, excellent. then, there redirect page /btn1.

my controller:

@restcontroller public class buttonscontroller { @postmapping("btn1") public void btn1() {     system.out.println("btn1"); }} 

how call controller method, stay on current strand?


Comments