--- GA: UA-81246538-4 --- # JSP 亂碼 :::warning 後端建置 category 的功能時,複製 user.jsp 改成 category.jsp 時發現換頁時,兩個頁面的字型規格不同且出現中文亂碼 ::: :::success 嘗試網路中消除亂碼的方式(設定UTF-8編碼)沒有效果,仔細檢查兩者差異時發現了不同,刪除後 JSP 顯示正常。 ::: :::info * ListUserServlet.java 中 ``` protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { UserServices userServices = new UserServices(entityManager, request, response); userServices.listUser(); } ```  * ListCategoryServlet.java 中 ``` protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.getWriter().println("List Category"); CategoryServices categoryServices = new CategoryServices(entityManager ,request, response); categoryServices.listCategory(); } ```  * 在 ListCategoryServlet.java 中刪除測試的句子 ``` response.getWriter().println("List Category"); ```  ::: ###### tags: `JSP`
×
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