I was externalizing in a file all my Javascript code inside and application, and to resolve all the EL variables inside the code I tried to use BalusC solution 2 proposed as an answer to this SO question.
I am trying to use the Faces Servlet to handle JS files when requested. The problem comes that when I set up so, the JS file is not found, and I can't guess where the problem is. This is my web.xml
<mime-mapping>
<extension>js</extension>
<mime-type>application/x-javascript</mime-type>
</mime-mapping>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/js/myapp-functions.js</url-pattern>
</servlet-mapping>
If I try to get the file through http://localhost:8080/myappname/js/myapp-functions.js I get a 404 error. The file is there (double checked). If I remove the mapping for the JS file, I can get the file normally (but as stated, the EL variables are not resolved).
Any suggestions? Thanks in advance.