java - Using ng-include into Spring Web Application does not work -


i trying use ng-include in web application based on angularjs , springmvc.

this tree of web-inf directory:

/web-inf     /views         /fragmentpages             footer.jsp         index.jsp 

in dispatcherservelet.xml added mapping /fragmentpages resources:

<mvc:resources mapping="/fragment/**" location="/web-inf/views/fragmentpages/" />   

into index.jsp done this:

<body ng-app="myapp">     <div ng-controller="myctrl">         ...     </div>     <div ng-include="${servletcontextpath}+'fragment/footer.jsp'"></div> </body> 

but viewing source code in browser see this:

<div ng-include="/project+'fragment/footer.jsp'"></div> 

and include not work.

why?

update

my tree now:

/resources     footer.jsp /web-inf     /views         /fragmentpages             footer.jsp         index.jsp 

in dispatcher done:

<mvc:resources mapping="/resources/**" location="/resources/" /> <mvc:resources mapping="/web-inf/**" location="/web-inf/" />     

in index.jsp if use:

<div ng-include="'${servletcontextpath}/resources/footer.jsp'"></div> 

it works!

but, instead, if use:

<div ng-include="'${servletcontextpath}/web-inf/views/fragmentpages/footer.jsp'"></div> 

not works.. how it's possible?

the answer

   @requestmapping("/footer")    public string footer(){     return "footer"; }  <div ng-include="'footer'"></div> 

Comments

Popular posts from this blog

angular - Is it possible to get native element for formControl? -

unity3d - Rotate an object to face an opposite direction -

javascript - Why jQuery Select box change event is now working? -