$ is not defined ,有以下几种可能:
1.没有导入jQuery的jar包
2.jQuery的jar包放进了WEB-INF里,jQuery的jar包最好放在WebContent下,跟WEB-INF同级
3.导入jQuery的路径名没有写对
4.jQuery没有包含js
错误的实例:
<script type="text/javascript">
$(function(){
});
</script>
<script type="text/javascript" src="/structs2_day01_atm/js/jquery-1.11.3.js"></script>
正确的实例:
<script type="text/javascript" src="/structs2_day01_atm/js/jquery-1.11.3.js"></script>
<script type="text/javascript">
$(function(){
});
</script>
5.在WEB-INF下的JSP导入JQuery的路径要用绝对路径,不能用相对路径,如:
<script type="text/javascript" src="/structs2_day01_atm/js/jquery-1.11.3.js"></script>
希望以上这些建议能对才学习的jQuery的同学有些帮助,本人自己也在努力学习中,相信自己,在学习JAVA的路上走得更远!