JSP 和 Servlet 之间跳转总结: 项目名。 Request.getContextPath() 即代表 /项目名。 如/news01 一、从 JSP 页面跳到其他页面或 Servlet 从 JSP 页面跳到其他页面使用全路径( /项目名/文件的路径 )。如项目名为 项目名/ news01,页面目录如下
1)比如从 index.jsp 页面跳到 main 文件夹下的 list.jsp 页面: 链接路径为:/news01/main/list.jsp 2) 比如从 index.jsp 页面跳到自己页面: 链接路径为: /news01/index.jsp 3) 比如从 list.jsp 页面跳到 index.jsp 页面: 链接路径为: /news01/index.jsp 4)比如从 list.jsp 页面跳到 insert.jsp 页面 链接路径为: /news/main/insert.jsp 5)Servlet 的 url 路径为:/servlet/TestServlet. 从任何
JSP 页面跳转到该 servlet 的链接路径为: /news01/servlet/TestServlet 6) Servlet 的 url 路径为:/TestServlet. 从任何 JSP 页面跳转到该 servlet 的链接路径为:/news01/TestServlet 7)Form 表单的 action 路径示例: