<title>Index Page</title>
<script type='text/javascript' src="${pageContext.request.contextPath}/jquery.js"></script>
<!--
<script type='text/javascript' src='/dwr/engine.js'></script>
<script type='text/javascript' src='/dwr/interface/helloworldService.js'></script>
<script type='text/javascript' src='/dwr/util.js'></script>
-->
</head>
【注意:多个库时jquery.js库放到最前面】
【
{pageContext.request.contextPath}/jquery.js"**
对应的文件结构位置(jquery.js)
web10.jsp测试文件源码:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!doctype html>
<html>
<head></head>
<body>
<label id="label1" >this is label1</label>
<input type="button" id="button1" value="button1">
<script src="${pageContext.request.contextPath}/jquery.js"></script>
<script>
$(document).ready( function(){
$("#button1").click( function(){
$("#label1").html("hello");
}
);
}
);
</script>
</body>
</html>
【注:$是jquery.js库中的一个函数名】