Is there a cross-platform way for accessing the JSP servlet?

In Tomcat, we can configure the Web app to treat non JSP files as JSP using the JSP servlet:


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:



This is nowhere specified in JSP specification. So there’s no crossplatform way to map resources on the JSP servlet like that.

Your best bet will be to have an actual .jsp file generating the desired JS content and map the /scripts/my.js on a <jsp-file> instead of <servlet-class> as follows:


Leave a Reply

Your email address will not be published. Required fields are marked *