HTTP Status 406 – Not Acceptable The target resource does not have a current representation that would be acceptable to the user agent, according to the proactive negotiation header fields received in the request, and the server is unwilling to supply a default representation.
controller code
@RequestMapping(value="/welcomes", method = RequestMethod.GET, produces="application/json")
public @ResponseBody List<UserBean> welcome(@ModelAttribute UserBean userBean, HttpServletResponse response)
{
List<UserBean> usernames=new ArrayList<UserBean>();
usernames = retrievedataservice.findAllUsers(userBean);
System.out.println(usernames.size());
return usernames;
}
angular js code
<script>
var app = angular.module('myApp', []);
app.controller('UserController', function($scope, $http, $location){
$scope.usernames=[];
var url = $location.absUrl() + "welcomes";
$http.get(url).then(function (response)
{
$scope.usernames = response.records;
},function error(response)
{
$scope.postResultMessage = "Error with status: " + response.statusText;
});
});
</script>
<table border="1" width="50%" height="50%">
<tr><th>user_name</th><th>phone</th><th>email</th></tr>
<tr data-ng-repeat="user in usernames">
<td>{{user.username}}</td>
<td>{{user.phone}}</td>
<td>{{user.email}}</td>
</tr>
</table>
how to send the data from spring controller to angular js controller?