struts2 访问页面的请求如下:
<dirurl>/consumption/queryAction.action</dirurl>admin/adminlist.jsp中的路径显示图片:
<img src="../images/lgo_0hm_129x36.on.gif" width="129" height="33">其中 images和admin目录同级。点击请求进去页面看不到图片,在myclipse的preview中可以看到换成:
<img src="images/lgo_0hm_129x36.on.gif" width="129" height="33">点击请求进去页面可以看到图片,在myclipse的preview中却看不到请问一下怎么解决
<dirurl>/consumption/queryAction.action</dirurl>admin/adminlist.jsp中的路径显示图片:
<img src="../images/lgo_0hm_129x36.on.gif" width="129" height="33">其中 images和admin目录同级。点击请求进去页面看不到图片,在myclipse的preview中可以看到换成:
<img src="images/lgo_0hm_129x36.on.gif" width="129" height="33">点击请求进去页面可以看到图片,在myclipse的preview中却看不到请问一下怎么解决
解决方案 »
- 加密机请求消息封装方法问题--急!!!
- 求教-------------java重定向的页面怎么实现全屏(IE的F11功能)?
- 问个myelipse下用spring的基础问题啊,高手回复下啊
- 求MyEclipse+weblogic开发SessionBean+JPA的详细案例!
- myBatis做多表查询的时候内存溢出
- JAVA数据结构
- STRUTS+ HIBERNATE3.0的错误,崩溃了~
- 用Hibernate如何构架C/S结构的程序
- 大哥大姐java application 是什么东西?
- java单例模式
- Statement和 PreparedStatement区别
- ibatis 大虾来帮帮我吧
执行起来没问题就可以了啊。相对路径,你的位置不同肯定就可以显示不到啊。myclipse不怎么用。
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
然后在head中
<base href="<%=basePath%>">
这样,它全部的路径不是从根路径开始了吗?
我希望两边都能看到
<%
String path = request.getContextPath();
String path1 = request.getServletPath();
int i = path1.lastIndexOf("/");
String path2 = path1.substring(0,i);
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + path2 + "/";
request.setAttribute("basepath",basePath);
%> <base href="<%=request.getAttribute("basepath")%>"/> 谢谢大家的帮助