Servlet中的路径问题

    xiaoxiao2021-03-26  28

    在编程过程中,难免会遇到很多路径不知道编写的问题,在这简单总结一下。

    在我现在的认识中,凡是服务器行为的就不能带上项目名,浏览器行为就要加上项目名

    public class PathDemo extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //转发: request.getRequestDispatcher("index.jsp").forward(request, response); //重定向: response.sendRedirect("/day09/index.jsp"); //html页面超链接: response.getWriter().write("<a href = '/day09/index.jsp'>link</a>"); //html页面表单提交action response.getWriter().write("<form action='/day09/index.jsp'><input type='submit'></form>"); } }

    转载请注明原文地址: https://ju.6miu.com/read-650296.html

    最新回复(0)