In Tomcat, we can configure the Web app to treat non JSP files as JSP using the JSP servlet:
<servlet-mapping>
<servlet-name>jsp</servlet-name>
<url-pattern>/scripts/my.js</url-pattern>
</servlet-mapping>
Is there a cross-platform way to map resources to the JSP servlet?
UPDATE: While there's not a cross-platform way available for mapping resources to the JSP servlet, it is possible to treat non-JSP files as JSP, using the <jsp-property-group>
element. For example, in order to treat all .js
files as JSP
, we can add the following fragment to the web.xml
:
<jsp-config>
<jsp-property-group>
<url-pattern>*.js</url-pattern>
<is-xml>false</is-xml>
</jsp-property-group>
</jsp-config>