Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
188
rated 0 times [  191] [ 3]  / answers: 1 / hits: 86401  / 11 Years ago, sat, november 16, 2013, 12:00:00

I am new to J2EE and Web development. Here is my issue:
I want to include angular.js in the webpage.



Here is the version that works:



<head>
<meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1>
<script src=http://code.angularjs.org/1.2.1/angular.min.js></script>
<title>Lets Meet Up!</title>
</head>


But I also want to have some local javascript files, and hopefully, I want to import the angularjs in the local directory



<head>
<meta http-equiv=Content-Type content=text/html; charset=ISO-8859-1>
<script src=WEB-INF/lib/angular/angular.js></script>
<title>Lets Meet Up!</title>
</head>


The the page is unable to run the javascript.



My stack is Tomcat, Spring MVC, Spring, J2EE
I put the angularjs source in
AppRoot/WebContents/WEB-INF/lib/angular



Anyone can help? THanks!!


More From » jsp

 Answers
7

Files in WEB-INF are inaccessible.



Put angular.min.js and all other static assets at the top level of your war file. Or better yet in some nice folder like js/angular/angular.min.js at the top level.



Then do this



<script src=js/angular/angular.min.js></script>


Depending on your needs you might want to consider serving your assets from a CDN, but that's another story altogether.


[#74258] Thursday, November 14, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bryantc

Total Points: 455
Total Questions: 96
Total Answers: 110

Location: San Marino
Member since Thu, Jun 30, 2022
2 Years ago
bryantc questions
Fri, Aug 13, 21, 00:00, 3 Years ago
Tue, Mar 30, 21, 00:00, 3 Years ago
Fri, Jun 5, 20, 00:00, 4 Years ago
Wed, May 27, 20, 00:00, 4 Years ago
;