1.项目根路径:<%=request.getContextPath()%>不可在js中使用
${pageContext.request.contextPath} 可在js中使用
2.servlet中:request.getRequestDispatcher("无需根路径/").forward()
response.sendRedirect("需要根路径/")
urlPattern ="/xx"
跳转servlelt:根路径/urlPatterns
3.resources资源文件:可以直接使用文件名称调用
4.MyBatis:<mapper nameplace="com.xx.dao.接口名">
mybatis-config:<mappers><mapper resource="com/xx/xxMapper.xml">
</mappers>
5.Spring : <bean class="com.xx.dao.impl.实现类名">
6.Maven: "${pageContext.request.contextPath}/webjars/jquery/1.8.3/jquery.min.js">
根路径/webjars/插件名/版本/文件名
7.Spring-MapperLocations:如果目录有*,则classpath也要有*
<property name="mapperLocations"
value="classpath*:com/cod4man/dao/user/*.xml" >
<property name="mapperLocations"
value="classpath:com/cod4man/dao/user/XMapper.xml" >
8.JNDI数据源引入(基于服务器):java:comp/env/resourceName(服务器的配置文件resources)
Web开发中的路径问题(持续更新)
猜你喜欢
转载自blog.csdn.net/weixin_43041241/article/details/87478429
今日推荐
周排行