Servlet中的路径问题

来源:互联网 发布:影音剪辑软件 编辑:程序博客网 时间:2024/04/25 21:58

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

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

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页面表单提交actionresponse.getWriter().write("<form action='/day09/index.jsp'><input type='submit'></form>");}}

0 0
原创粉丝点击