这是项目内部的结构。
我想要的是将js文件加载到html文件中
这是代码。
<!DOCTYPE html>
<html>
<head>
<title>Third App</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width,
initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user- scalable=no"/>
<!-- <link href="/ThirdApp/WebContent/lib/jquery/jquery.mobile-1.3.2.css" rel="stylesheet" type="text/css" />-->
<script src="/ThirdApp/WebContent/lib/jquery/jquery-1.9.1.js"></script>
<script src="/ThirdApp/WebContent/lib/jquery/jquery.mobile-1.3.2.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<h1>HOME</h1>
</div>
<div data-role="content">
<!--<a href="02_menuform.html" data-role="button">MENU</a>-->
<a href="/FirstApp/jsp/menu.jsp" data-role="button">MENU</a>
<a href="02_busform.html" data-role="button">BUS</a>
<a href="02_restaurantform.html" data-role="button">DELIVERY CONTACT</a>
</div>
</div>
</body>
</html>
我认为这条路是正确的。但是,如果我运行该应用程序,则找不到404。我认为这意味着路径是错误的。
我想您不应该将脚本保存在lib文件夹中。将所有脚本移动到另一个文件夹。可以WebContent/scripts/
。将所有.js
文件放在那里。然后在jsp
使用中jstl
:
<script src='<c:url value="/scripts/jquery-1.9.1.js"/>'></script>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句