eclipse里怎么导入js?

wonglaye 2009-11-04 04:13:15
这是我在eclipse里一个jsp文件,引用了一个treeview的js代码
<%@ page language="java" contentType="text/html; charset=GBK"
pageEncoding="GBK"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="StyleSheet" href="style/dtree.css" type="text/css" />
<script type="text/javascript" src="js/dtree.js"></script>
<title>左边菜单</title>
</head>
<div class="dtree">

<p><a href="javascript: d.openAll();">open all</a> | <a href="javascript: d.closeAll();">close all</a></p>

<script type="text/javascript">
<!--

d = new dTree('d');

d.add(0,-1,'My example tree');
d.add(1,0,'Node 1','example01.html');
d.add(2,0,'Node 2','example01.html');
d.add(3,1,'Node 1.1','example01.html');
d.add(4,0,'Node 3','example01.html');
d.add(5,3,'Node 1.1.1','example01.html');
d.add(6,5,'Node 1.1.1.1','example01.html');
d.add(7,0,'Node 4','example01.html');
d.add(8,1,'Node 1.2','example01.html');
d.add(9,0,'My Pictures','example01.html','Pictures I\'ve taken over the years','','','img/imgfolder.gif');
d.add(10,9,'The trip to Iceland','example01.html','Pictures of Gullfoss and Geysir');
d.add(11,9,'Mom\'s birthday','example01.html');
d.add(12,0,'Recycle Bin','example01.html','','','img/trash.gif');

document.write(d);

//-->
</script>
</div>
</body>
</html>
dtree.js放在了d:\eclipse\workspace\MIS\js文件夹下了,我发现如果手动把文件复制到ROOT里可以运行,但是在eclipse里调试运行就不通过,不能显示那个树形菜单,发现tomcat报错信息为:The requested resource (/MIS/js/dtree.js) is not available.
我已经把dtree.js导入到eclipse的javascript支持路径里了
...全文
4154 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
george_hsu 2009-11-05
  • 打赏
  • 举报
回复

george_hsu 2009-11-05
  • 打赏
  • 举报
回复



我在articleManage.jsp里的JS引用:
<script type="text/javascript" src="../../module/js/dtree.js"></script>
样式引用:
<link rel="StyleSheet" href="../../style/common/dtree.css" type="text/css" />
wonglaye 2009-11-05
  • 打赏
  • 举报
回复
webcontent下面我也放了
sqy137 2009-11-05
  • 打赏
  • 举报
回复 2
你的js可以在head标签里加入这句话看看<script type="text/javascript" src="<%=request.getContextPath() %>/js/dtree.js"> </script>
夜雨~听风 2009-11-05
  • 打赏
  • 举报
回复
3楼的哥讲的很详细!!!
spllot 2009-11-04
  • 打赏
  • 举报
回复
d:\eclipse\workspace\MIS\js是什么路径
你应该在项目目录下的webroot下建一个Js文件夹,放进去

87,910

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧