script中
<script> var contextPath= [[@{/}]]; </script>
html中,以form为例,将form前面添加"th:",其中“/account/index”为controller里定义的路径
<form id="loginForm" th:action="@{/account/index}" method="post" class="form-horizontal form-group"> </from>