Saturday, May 11, 2013

Configure Tomcat to Parse Files Other Than JSP

To configure Tomcat to parse other file extensions

  1. Go to Tomcat Conf folder.
  2. Open the web.xml file with a text editor.
  3. Search for the tag ''
Under the comment   at around line #382
you will see 2 branches for JSP mapping.

<!-- The mapping for the JSP servlet -->
<servlet-mapping>
   <servlet-name>jsp</servlet-name>
   <url-pattern>*.jsp</url-pattern>
</servlet-mapping>

<servlet-mapping>
   <servlet-name>jsp</servlet-name>
   <url-pattern>*.jspx</url-pattern>
</servlet-mapping>

  4. Create a new branch for the extension you want
Let say you want to create an extension for TainoSystems Files like  .tno

You just create a branch with servlet-name=jsp and url-pattern=*.tno
   

<servlet-mapping>
   <servlet-name>jsp</servlet-name>
   <url-pattern>*.tno</url-pattern>
</servlet-mapping>

   


Don't forget to save the web.xml file
and restart tomcat.

Now all your *.tno files will be parsed by Tomcat as if they were *.jsp files

They are so many things you can do with Tomcat.


By Winslas R. Anilus