大家好我是第一次集成angularjs和java,但我确实在angularjs方面有丰富的经验。我的问题是如何检索传递给java servlet的对象。
我使用angularjs服务传递数据
function validateUser(){
var defer = $q.defer();
$http.POST('api/user', data)
.then(function(response) {
defer.resolve(response);
}).catch(function(response) {
defer.reject(response);
})
return defer.promise;
}
和我的java servlet API:
@WebServlet("/api/user")
public class UserController extends HttpServlet {
private static final long serialVersionUID = 1L;
public UserController() {
super();
}
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
}
protected void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
//store request body
}
}
我的目标是让整个对象不仅仅是参数,如果可能的话。谢谢你提前