有关路径的总结

来源:互联网 发布:淘宝买翡翠是真的吗 编辑:程序博客网 时间:2024/05/21 10:54

public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {

    /*    0、/为绝对路径    1、服务器行为指的是部署在服务器上的项目,直接/+文件名    2、浏览器行为需要/+项目名和文件名    */            //服务器转发    //request.getRequestDispatcher("/index.jsp").forward(request, response);    //浏览器重定向 会转向该文件!    //response.sendRedirect("/test/index.jsp");    //html页面的超链接    //response.getWriter().write("<a href='/test/index.html'>link!</a>");    //html页面的表单的action    response.getWriter().write("<form action='/test/index.html'><input type='submit'/></form>");    //跳不过去?}
原创粉丝点击