Eclipse下Web项目路径跳转

项目结构以下:浏览器

src                : com.restaurant.servlet --> RegisterServlet服务器

WebContent : ch03                            -->  register.jspjsp

 

浏览器输入 localhost:8080/项目名/ch03/register.jsp 要跳转到src 下的RegisterServletui

使用相对路径 jsp中应该这样写:action="/restaurant/servlet/RegisterServlet"rest

使用绝对路径 没办法访问 只能改用相对路径ip

 

一句话:get

相对路径:         起始就是发起跳转的文件的所在路径 localhost:8080/项目名/xxx.jsp----localhost:8080/项目名/xxxServlet博客

绝对路径:加 /    路径的起始就是服务器IP地址  localhost:8080/项目名/xxx.jsp----localhost:8080/项目名/xxxServletservlet

 

参考博客:https://www.wandouip.com/t5i210656/io

相关文章
相关标签/搜索