I've been searching for answered questions in here but i couldn't find the suitable one for me. I have an issue when trying to import my javascript files in my html (I'm coding in Eclipse Mars 2.0). I'm using apache tiles for template creation and the project is (trying to be) built in Angularjs. Here i attach some code and screenshots.
My html looks like this, in this first case ${contexto} value is "home"
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><tiles:insertAttribute name="title" ignore="true" /></title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.js"></script>
<script src="http://angular-ui.github.io/ui-router/release/angular-ui-router.js"></script>
<script src="js/${contexto}/${contexto}-app.js"></script>
<script src="js/${contexto}/${contexto}-service.js"></script>
</head>
<body>
<tiles:insertAttribute name="header" />
<tiles:insertAttribute name="body" />
<tiles:insertAttribute name="footer" />
</body>
</html>
My project is structured this way project structure
And the error I'm getting when deploying it is this one: chrome error
Thanks in advance!!!
EDIT I think the problem is related with the servlet configuration... if I comment the servlet config in my web.xml I can access the localhost:8080/web/js/home/home-app.js file and i have the "Hello world" form index.htm but cannot access to localhost:8080/web/home. On the other hand if i discomment them, i cannot access the js files but i can access localhost:8080/web/home. Here is my web.xml if it helps...
...
<!-- ==============Spring============= -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- Processes application requests -->
<servlet>
<servlet-name>appServlet</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/servlet/servlet-config.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>appServlet</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>webapp.web</param-value>
</context-param>
</web-app>
SOLUTION I could solve the issue, defining the resources in the jsp as spring resources instead of the conventional ... tag.
viewsdirectoryscripttag to be accessible from your browser. For example:http://localhost:8080/home/js/home/home-app.jsshould be available from your browser.