I have some javascript files that need to be dynamically generated. It's purely i18n stuff, and I use the struts 2 convention plugin. I'm successfully able to do this when I omit the .js extension from both the URL and the source file, like this:
Convention Plugin will hit this JSP:
WEB-INF/content/dynamic-javascript-file.jsp
with the URL in this page:
<html>
<head>
<script type="text/javascript" src="dynamic-javascript-file"></script>
</head>
<body>
blah blah blah
</body>
</html>
BUT, what I would like to do is this:
WEB-INF/content/dynamic-javascript-file.js
And
<html>
<head>
<script type="text/javascript" src="dynamic-javascript-file.js"></script>
</head>
<body>
blah blah blah
</body>
</html>
Note, the only difference is that both the url and the file itself have their native .js extension. The motivations for this are to keep from confusing devs and tools. Also note, another requirement is that other javascript files should be served as static resources.