【发布时间】:2010-10-28 02:16:22
【问题描述】:
是否必须使用 struts2-jquery 插件才能在 struts2 应用程序中运行 jQuery 代码?
我正在开发一个 struts2 网络应用程序
jQuery 文件:WebContent/js/jquery-1.4.3.js
JSP页面位置:WebContent/pages/*.jsp
THDFindYourQuote.jsp 是应用程序的默认页面:
我在 THDFindYourQuote.jsp 中有一个简单的脚本
[script type="text/javascript" src="../js/jquery-1.4.3.js"][/script]
[script type="text/javascript"]
$(document).ready(function(){
alert('I am in the JSP code now!!');
});
当我访问 url 时执行上述脚本:
localhost:8081/CloseQuote/pages/THDFindYourQuote.jsp
当我访问 URL 时,相同的脚本不起作用:
localhost:8081/ CloseQuote/
我在其他 JSP 中遇到了同样的问题。当我使用完整路径 URL 访问 jsp 时,该脚本有效。当我使用操作 url 访问 jsp 时它不起作用..请帮助
【问题讨论】: