开发者

Calling JSP file from JavaScript

I am calling a Servlet from index.jsp using Ajax. If the result is false, I have to display an error message on index.jsp it开发者_如何学Cself. But, if the result is true, how do I call another JSP page?


In JavaScript, you can use window.location to change the current location.

E.g.

if (result.error) {
    document.getElementById('message').innerHTML = result.error;
} else {
    window.location = 'another.jsp';
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜