我在页面中有这样一条javascript语句:setTimeout(doOperate('doGame'), 5000);但是发现其中的doOperate('doGame')方法
执行了,但是程序根本没有停滞.如果改成这样:setTimeout("doOperate('doGame')", 5000);就出现错误提示:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.NoSuchMethodException: Action[/petInfo] does not contain specified method (check logs)
root cause
java.lang.NoSuchMethodException: Action[/petInfo] does not contain specified method (check logs)
note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs.
而我的/petInfo对应的Action中也正确定义了doGame方法
执行了,但是程序根本没有停滞.如果改成这样:setTimeout("doOperate('doGame')", 5000);就出现错误提示:
HTTP Status 500 -
type Exception report
message
descriptionThe server encountered an internal error () that prevented it from fulfilling this request.
exception
javax.servlet.ServletException: java.lang.NoSuchMethodException: Action[/petInfo] does not contain specified method (check logs)
root cause
java.lang.NoSuchMethodException: Action[/petInfo] does not contain specified method (check logs)
note The full stack traces of the exception and its root causes are available in the GlassFish v3 logs.
而我的/petInfo对应的Action中也正确定义了doGame方法
window.setTimeout = (function() {
var fun = arguments[0], timeout = arguments[1], args = Array.prototype.slice.call(arguments, 2);
window._setTimeout(function() {
fun.apply(null, args);
}, timeout);
});调用的时候, 和普通的setTimeout一样, 不过可以在后面追加参数.
服务器端出错了
应该和你的doOperate('doGame')方法执行有关的,跟js本身没关系的
看看后台有没有报错,定位下错误原因