有人在Spring MVC中帮我解决ajax问题

时间:2015-10-23 13:33:55

标签: javascript ajax spring jsp

I have a login.jsp contain: 2 text box username and password:

    <h1 id="loginID">Login required</h1>
    <form>
        <input type="text" name="username"><br> <br /> <input
            type="password" name="password" required> <br> <br>
        <input type="submit" onclick="loginEvent()" value="login">
    </form>

, and an javaScript file called loginAjax.js:

//我的loginAjax.jsp位于WEB-INF / resources / pages / loginAjax.jsp中 //我的spring-mvc-servlet.xml:

    xmlHttp.onreadystatechange = stateChanged;
    xmlHttp.open("GET", url, true);
    xmlHttp.send(null)
}
and a file JSP loginAjax.jsp to access database :

//在浏览器中运行时ajax不起作用!

and in console of Browser :
error: GET http://localhost:8899/SpringMVCHibernateTransaction/%3Cc:url%20value= 404 (Not Found)

1 个答案:

答案 0 :(得分:0)

Ajax是用于创建异步Web应用程序的客户端技术。这里的错误是404.所以,Ajax确实有效。但是服务器中没有相应的资源。