Is it possible to tell a standard Java EE servlet container to interpret and render a file as a JSP even if it doesn't have a .jsp extension?
Say I have a file called foo.xyz in the root directory of my WAR. This file contains some jstl logic as you would expect in a .jsp file. If I request http://myserver/myapp/foo.xyz I'm going to see the literal code from that file rendered as text. Is there a way to configure the web app such that it renders the file using the JSP interpreter without changing the files extension?
Please don't ask why I'd want to do this. The constraints are complicated.
The recommended file extension for the source file of a JSP page is . jsp. The page can be composed of a top file that includes other files that contain either a complete JSP page or a fragment of a JSP page.
No, you don't need, jsp file can be directly invoked by URL.
This package contains an easy to use and easy to install file browser java server page. This JSP program allows remote web-based file access and manipulation. Features: - Create, copy, move, rename and delete files and directories - Shortkeys - View Files (pictures, movies, pdf, html,…)
Basically to open a . jsp file, you can use notepad , notepad++ , eclipse , textpad and so on. To open whole application, debug, run and test, better to use Eclipse .
You can add the following configuration in your web.xml
to make files ending with .xyz
beeing processed as JSP:
<jsp-config>
<jsp-property-group>
<url-pattern>*.xyz</url-pattern>
</jsp-property-group>
</jsp-config>
This solution is working with Tomcat and Websphere. And probably with any JEE compliant server container.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With