【发布时间】:2015-10-23 13:33:55
【问题描述】:
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)
【问题讨论】:
-
那么你能指导我在春季从 Ajax 调用请求到控制器吗?例如:我认为:我将在我的 Controller 中创建 @RequestMapping("/user"),然后 ajax 将调用 $.ajax({ url:'user.jsp',// 我认为这将映射到 //@ RequestMapping("/user") data:({name:'luong'}), success:function(data){ $("#user").html(data); } });
标签: javascript ajax spring jsp