spring mvc - in jsp using angularjs $http the url is unreadable code -



spring mvc - in jsp using angularjs $http the url is unreadable code -

here app.js:

class="lang-js prettyprint-override">var loginmodule = angular.module('loginmodule',[]); loginmodule.config(['$httpprovider', function ($httpprovider) { $httpprovider.defaults.headers.post['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8'; }]); loginmodule.controller('loginctrl',function ($scope,$http,$parse){ $scope.signin_user = {name:"",password:""}; $scope.errors = []; $scope.submit = function(){ if($scope.login_form.$valid){ var info ="name="+$scope.signin_user.name+"&password="+$scope.signin_user.password; $http({ method:'post', url:'${ctx}/login', data:data }) .success(function(data,status){ console.log(data); }) .error(function(data,status){ console.log('status:'+status); }); } }; });

in login.jsp i'm using jstl web root,here tag.jsp, in login.jsp include file,which can utilize ${ctx} web root.

class="lang-html prettyprint-override"><%@ page language="java" contenttype="text/html; charset=utf-8" pageencoding="utf-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <c:set var="ctx" value="${pagecontext.request.contextpath }" ></c:set>

but don't understand happend in angularjs, using $htpp.post(url:'${ctx}/login'),just app.js file. , utilize chrome developer tools watch request url,i find request url picture: http://i.stack.imgur.com/ewgs2.png url append other unreadable code. hope can prepare it,thank all. if can't see picture, tell in chrome developer tools request url 'localhost:8080/cloudaction/$%7bctx%7d/login '

i guess content type on both side should same work. seek angularjs side setting content-type "text/html" or both side "application/json".

angularjs spring-mvc

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -