Allow EL variables in Javascript using FacesServlet

I used the external code in the file for all my Javascript code inside and for the application and for resolving all EL variables inside the code, which I tried to use to solve BalusC 2, proposed as an answer to this SO question .

I am trying to use Servlet Faces to process JS files on request. The problem is that when I configure this, the JS file is not found, and I cannot figure out 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>

http://localhost:8080/myappname/js/myapp-functions.js, 404. ( ). JS , (, , EL ).

? .

+3
1

javax.faces.DEFAULT_SUFFIX, *.xhtml. , <script></script>, SAX Facelets -wellformed document.

+1

Source: https://habr.com/ru/post/1753274/


All Articles