ssh项目中使用Action跳转后css失效的解决方法
2017-03-16 11:24
423 查看
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
然后在加载css的路径前添加<%=basePath%>就可以了。
例如:<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/login.css">
利用跳转以后原来的路径会找不到css的路径。或者用${ pageContext.request.contextPath }获取上下文对象重新跳转
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
然后在加载css的路径前添加<%=basePath%>就可以了。
例如:<link rel="stylesheet" type="text/css" href="<%=basePath%>/css/login.css">
利用跳转以后原来的路径会找不到css的路径。或者用${ pageContext.request.contextPath }获取上下文对象重新跳转
相关文章推荐
- ssh项目中使用Action跳转后css失效的解决方法
- 关于使用struts2跳转后css和js失效的解决方式
- 关于使用struts2跳转后css和js失效的解决方式
- ssh 项目中struts2 "input"返回后无法执行Action解决方法
- 关于使用struts2跳转后css和js失效的解决方式
- action跳转页面css和js失效问题解决
- struts中Action跳转jsp页面图片.css乱----解决方法
- jsp action跳转页面css和js失效问题解决
- ASP.NET MVC- 在Area里使用RedirectToAction跳转出错的解决方法
- 关于使用struts2跳转后css和js失效的解决方式
- struts2 Action返回JSP页面CSS和JavaScript失效的解决方法。
- Java SSH项目中找不到action错误解决方法
- 使用ActionlessForm.cs重写Form后使得验证控件失效的解决方法
- 关于使用struts2跳转后css和js失效的解决方式
- 关于使用struts2跳转后css和js失效的解决方式
- 使用struts2跳转后css和js失效的解决方式
- action跳转时css和js失效问题解决
- 解决SSH项目中Action跳转之后,页面样式、图片丢失的问题
- jQuery Mobile页面跳转导致css、js失效原因及解决方法
- action跳转页面css和js失效问题解决