0

How can I change context root path from http://host:port/app_name to only an app_name in web.xml file or another way in Dynamic Web Project.

Actually, I'm facing an issue to import local javascript, css and other resources into my view say html/jsp.

for example, I have some js and css files inside resources folder of web-content. Now to import these I'm using below code.

<link rel="stylesheet" href="http://localhost:8080/appname/resources/css/bootstrap.min.css">

<script type="text/javascript" src="http://localhost:8080/appname/resources/js/angular.min.js"></script>
<script type="text/javascript" src="http://localhost:8080/appname/resources/js/jquery.min.js"></script>
<script type="text/javascript" src="http://localhost:8080/appname/resources/js/bootstrap.min.js"></script>

So now I want to change http://localhost:8080/appname/ to the only appname/ means <script type="text/javascript" src="appname/resources/js/angular.min.js"></script> as host and port dynamic in nature and can be changed anytime. So how can I achieve it.

Aditya
  • 1,214
  • 7
  • 19
  • 29

0 Answers0