<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()+ path + "/";
%>
这是设置基础路径的,basepath为变量
简单的静态网页的话你设置比如:<base href="http://www.baidu.com">,那你下面的href属性就会以你上面设的为基准,如:<a href="http://www.baidu.com/xxx.htm"></a>你现在就只需要写<a href="xxx.htm"></a>
分享到:
相关推荐
<td><a href='addUser.jsp'>添加</a> <a href='<%=basePath%>DelUserServlet?id=<%=users.getId()%>'>删除</a> <a href='updateUser.jsp'>更新</a> <a href="login.jsp">登陆</...
<base href="<%=basePath%>"> <title>用户注册</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> ...
spring 的实例源码 <base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> ...
<base href="<%=basePath%>"> <title>My JSP 'text1.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta ...
<html><br> <head><br> <base href="<%=basePath%>"><br> <br> <meta http-equiv="content-type" content="text/html;charset=UTF-8"/> <br> <br> <br> <meta http-equiv="pragma" content="no-cache"><br> <meta ...
<base href="<%=basePath%>"> <title>My JSP 'text.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta ...
<link href="<%=basePath %>css/base.css" rel="stylesheet" type="text/css"> <link href="<%=basePath %>css/reg.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="<%=basePath %>css/...
<base href="<%=basePath%>"> <title>提交网页</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> ...
<base href="<%=basePath%>"> <title>主页面</title> </head> <body> <div align="center"> <table> <tr> <th>主页面</th> </tr> </table> </div> <jsp:include page="4-3.jsp"> <jsp:param value="John...
<base href="<%=basePath%>"> <title>MyJSP 'test.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta ...
<base href="<%=basePath%>"> <title>My JSP 'userRegister.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta ...
<base href="<%=basePath%>"> <title>动漫搜索</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> ...
<base href="<%=basePath%>"> <title>Login Page</title> <!-- Meta tags for SEO --> ... </head> <body> <% if (username != null) { %> 用户名: <%= username %> <br/> <% } %> <!-- Display the form ...
<base href="<%=basePath%>"> <title>My JSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta ...
<base href="<%=basePath%>"> <title>MyJSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta ...
<base href="<%=basePath%>"> <title>中国证券会证券期货违法违规举报中心-注册</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta ...
<base href="<%=basePath%>"> <title>入口页面</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> ...
<base href="<%=basePath%>"> <title>MyJSP 'index.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta ...
<base href="<%=basePath%>"> <title>MyJSP 'insdata.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta ...