WEB-INF
|
+----static
|
+---- angular
|
+----angular.min.js
+---- css
|
+---- html
|
+----index.html
dispacher-servlet.xml contents are as below
<mvc:annotation-driven/>
<mvc:default-servlet-handler/>
<mvc:resources mapping="/static/**" location="/WEB-INF/static/" />
<mvc:resources mapping="/static/html/**" location="/WEB-INF/static/html/" />
<mvc:resources mapping="/static/angular/**" location="/WEB-INF/static/angular/" />
<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="order" value="1" />
<property name="mediaTypes">
<map>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
<entry key="rss" value="application/rss+xml" />
<entry key="html" value="text/html"/>
<entry key="js" value="text/javascript"/>
</map>
</property>
<property name="defaultViews">
<list>
<bean class="org.springframework.web.servlet.view.json.MappingJackson2JsonView" />
</list>
</property>
</bean>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="order" value="2" />
</bean>
content of web-inf/static/html/index.html is as below
<!DOCTYPE html>
<html ng-App>
<head>
<script src="angular.min.js"></script>
</head>
<body>
<h2>Hello World!</h2>
<input type="text" ng-model="name"/>
Welcome {{name}}
MyController class is as below
public class MyController {
@RequestMapping(value = "/service/greeting/{name}", method = RequestMethod.GET)
public String getGreeting(@PathVariable String name) {
String result="Hello "+name;
return result;
}
@RequestMapping(value="/")
public ModelAndView showHomePage(ModelAndView mv ) {
mv.setViewName("/static/html/index.html");
return mv;
}
}
index page is up but what could be the issue with angular js which is showing GET 404 error in web console of browser?