JSP中<base href="<%=basePath%>">作用
2013-07-26 09:45
651 查看
通常在JSP页面开通有如下代码:
Java代码
![](http://lzc0088.iteye.com/images/icon_star.png)
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
这段代码的意思是获取当前项目的路径,如:http://localhost:8080/项目名称。
在<head></head>中通常有如下代码:
Java代码
![](http://lzc0088.iteye.com/images/icon_star.png)
<base href="<%=basePath%>">
这是设置基础路径的,basePath为变量,简单的静态网页的话你设置比如:<base href="http://www.baidu.com">,那你下面的href属性就会以你上面设的为基准,如:<a href="http://www.baidu.com/xxx.htm"></a>你现在就只需要写<a
href="xxx.htm"></a>
原文地址:/article/3955117.html
Java代码
![](http://lzc0088.iteye.com/images/icon_star.png)
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
这段代码的意思是获取当前项目的路径,如:http://localhost:8080/项目名称。
在<head></head>中通常有如下代码:
Java代码
![](http://lzc0088.iteye.com/images/icon_star.png)
<base href="<%=basePath%>">
这是设置基础路径的,basePath为变量,简单的静态网页的话你设置比如:<base href="http://www.baidu.com">,那你下面的href属性就会以你上面设的为基准,如:<a href="http://www.baidu.com/xxx.htm"></a>你现在就只需要写<a
href="xxx.htm"></a>
原文地址:/article/3955117.html
相关文章推荐
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">的作用
- JSP中的 < base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- MyEclipse中建立的jsp文件中<base href="<%=basePath%>">可能会带来的问题.
- (6)开发收获 <base href="<%=basePath%>">JSP页面中的相对路径问题
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">的作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用
- JSP中<base href="<%=basePath%>">作用