最近寫的一個項目包含的幾點小知識

頁面直接訪問action

<button onclick='findAndUpdate("${subject.fdId}")'>修改</button>

<script type="text/javascript">

        function findAndUpdate(id){

           window.location.href="${path}/subject/findSubject.do?args="+id;

 }

 </script>

<a href=” ${path}/subject/findSubject.do?args="+id”>修改</a>

在頁面獲取path路徑,
頁面的所有路徑就可以這樣寫了

<%

         String path = request.getContextPath();

         String basePath = request.getScheme() +"://"

                            +request.getServerName() + ":" + request.getServerPort()

                            + path + "/";

         request.setAttribute("path", path);

%>

 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章