简体   繁体   中英

spring and angulaJS(i am getting error like HTTP Status 404 )

I am getting an HTTP Status 404 error in my controller.

Server code

@RequestMapping(value="/showMsg/",
method=RequestMethod.GET,produces=
{
"application/json"
})'

public ResponseBody String show(){
    HashMap hash = new HashMap();
    hash.put("msg", "welcome to spring angular js");
    return hash;
}

AngularJS code

$http.get('HelloWorld/showMsg').success(function(data){
    alert("Success");
}).error(function(data){
    alert("Error");
});

I get an HTTP Status 404 error.

URL is wrong in this case.

Define correct URL something like below:

$http.get('http://localhost:8000/HelloWorld/showMsg')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM