日期:2014-05-18  浏览次数:20594 次

大家是否遇见过这样的情况呢 ?
问题描述:首页是iframe 的框架页,里面有三个iframe ,其中left是左侧操作菜单的页面,页面里面展示的属性操作菜单是通过EXTJS 生成的, 树是生成了,可是 连接的路径总是不对,还望各位达人帮忙给看下

数据库中的

/operManager.do?method=add


后台组织JSON打印的结果页是

{id:4,text:'新增操作员',href:'/operManager.do?method=add',hrefTarget:'right',leaf:true},


但是当到首页显示的时候,链接的路径就变成了

http://localhost:8080/operManager.do?method=add //注意这个路径没中没有项目名称 

如果我把 数据库中的“/operManager.do?method=add” 变成“operManager.do?method=add”

则页面上显示的路径就成了“http://localhost:8080/projectName/pages/include/operManager.do?method=add”

注意粗体部分,虽然有了工程的名字,但是他也把框架中左侧页面left.jsp所在的文件夹路径“/pages/include”也给带上了

请问各位达人这是怎么回事啊?该如何解决呢?

------解决方案--------------------
为什么不能写成/projectName/operManager.do?method=add,一般情况下工程名是不会变的啊,写死又如何呢?
------解决方案--------------------
<%=basePath%>/operManager.do?method=add 
../operManager.do?method=add
------解决方案--------------------
悲剧 悲剧啊
------解决方案--------------------
../../../operManager.do?method=add自己试试。
------解决方案--------------------
JSP页面

var basePath = "${pageContext.request.contextPath}";

你在EXT JS中写的URL 就写成

basePath + "/operManager.do?method=add"