网页代码中用<%=request.getContextPath()%>和不用的区别?
来源:互联网 发布:42u图腾网络机柜尺寸 编辑:程序博客网 时间:2024/05/21 21:08
举报违规检举侵权投诉|2007-10-15 16:25 mars472777 | 浏览 44293 次
<%=request.getContextPath()%> 问题!我的网站代码里有链接的地方都放了<%=request.getContextPath()%>我查了一下,<%=request.getContextPath()%>是为了解决相对路径的问题,可返回站点的根路径。我是初学者,希望能有高手能指点一下,帮我讲讲以下几个问题:1、<a href="<%=request.getContextPath()%>/XXXX.jsp"> 和<a href="XXXX.jsp"> 有什么差别?2、用<%=request.getContextPath()%>之后,搜索引擎会不会对这个链接找不到。
举报违规检举侵权投诉|2007-10-15 16:37
提问者采纳
request.getContextPath()应该是得到项目的名字,如果项目为根目录,则得到一个"",即空的字条串, 如果项目为abc, <%=request.getContextPath()% >/ 将得到abc/,服务器端的路径则会自动加上,<a href="XXXX.jsp"> 应该就是指当前路径下的这个xxx.jsp页面,有时候也可以在head里设置html:base来解决路径的问题,不过用的最多的还是request.getContextPath。
0 0
- 网页代码中用<%=request.getContextPath()%>和不用的区别?
- request.getContextPath()和request.getRealPath()的区别
- ${pageContext.request.contextPath}和request.getContextPath()的区别
- 关于<%=request.getContextPath()%>和${pageContext.request.contextPath}的问题
- <a href="<%=request.getContextPath()%>/XXXX.jsp"> 和<a href="XXXX.jsp"> 的区别?
- ${pageContext.request.contextPath}和<%=request.getContextPath()%>
- ${pageContext.request.contextPath}和<%=request.getContextPath()%>
- ${pageContext.request.contextPath}和<%=request.getContextPath()%>
- <%=request.getContextPath()%>的作用
- <%=request.getContextPath()%>的作用
- <%=request.getContextPath()%>的作用
- request中getContextPath、getServletPath的区别
- request.getContextPath(),request.getServletPath() 区别
- pagecontext.request.getcontextpath和request.getContextPath()
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Request中getContextPath、getServletPath、getRequestURI、request.getRealPath的区别
- Xcode 7 IOS9 问题大全及解决
- 深入浅出Mysql(四)
- GO标准库概述
- jQuery 中bind(),live(),delegate(),on() 区别
- iOS学习笔记28-JS执行过程分析
- 网页代码中用<%=request.getContextPath()%>和不用的区别?
- 【烙铁使用规范】——烙铁的使用
- [android]service中启activity
- 最短路 - Dijkstra()
- wordpress建立自定义菜单
- Pilots(pilots)题解
- Runtime.getRuntime().exec(strMakePathPath);
- 【CCF】相反数
- 使用ServletContextListener无法直接注入sping配置文件中接口解决办法