tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Randall Parker" <randa...@nls.net>
Subject How to map non-jsp URL to a JSP?
Date Fri, 27 Jul 2001 22:58:49 GMT

Looking at web.xml its easy to see how all .jsp files can be mapped to the JSP servlet:
  <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>*.jsp</url-pattern>
  </servlet-mapping>

This relies on two things:
   1) The *.JSP suffix to specify that its a JSP.
   2) I presume that the prefix after the last forward slash of the path must be the particular
JSP 
name to pass to the jsp servlet as a sort of argument.

Okay, but is it possible to map a particular arbitrary existing .html path to a JSP and have
that 
JSP name not be directly from that path?

I'd like to do something like:

  <servlet-mapping>
    <servlet-name>jsp</servlet-name>
    <url-pattern>/dataview/latest/*.html</url-pattern>
  </servlet-mapping>

I would expect that to take:
   /dataview/latest/forecast.html
and translate it to tell the jsp servlet to invoke:
   forecast.jsp 

But I'd really like to hide the real JSP names. For instance, make
   /dataview/latest/forecast.html
 map to a jsp that is
   LatestForecast.jsp

Does anyone have an example of how this is done? I've read thru the Sun servlet specs 2.2
and 
2.3 and they don't really say that much about the nuances of doing things in web.xml. Even
2.3 
spec's chapter 11 doesn't say much. 





Mime
View raw message