# processTemplate的用處(資源跳轉) ###### tags: `Java Web-常用知識點` ```java= //資源跳轉功能 super.processTemplate("index",request,response); //相當於 //此處需要【重定向】,目的是重新給IndexServlet發請求,重新獲取fruitList,然後覆蓋到session中,這樣index.html頁面顯示的session中的數據才是ˊ最新的 response.sendRedirect("index"); //不能使用下面這句 //getRequestDispatcher為轉發,與先前訪問是同一次訪問,因此index.html的頁面不會更新,兒還是顯示舊資料 request.getRequestDispatcher("index.html").forward(request,response); ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up