• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

need help: .jsp to .jspf mapping

 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rancher's,

In the Errata For Head First Servlets and JSP, it mentions:


{407} whole page;
As the .jspf convention is not supported by default in Tomcat, the following mapping needs to be added to the application's web.xml for the example to work correctly:





I am confused reading this, currently i am working with Tomcat 5.5.17 and included a .jspf file using the include directive and it worked fine, i did not have to do any kind of mapping as mentioned above to get this working.

Is the above mentioned for some older version of tomcat or still holds good for newer versions.



Thanks in Advance,
Reshma
 
Charles Lyons
Author
Ranch Hand
Posts: 836
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am confused reading this, currently i am working with Tomcat 5.5.17... Is the above mentioned for some older version of tomcat or still holds good for newer versions.

The obvious thing to do would be to check your own Tomcat's default web.xml file to find out what default mappings it contains. This should be in $TOMCAT_HOME/conf/web.xml. If you see a <servlet-mapping> for jspf, you'll know that's installed by default. My Tomcat 5.0 installation doesn't include that mapping. Note that you can always modify your conf/web.xml as well if you want to add this mapping across all applications, to save having to write it in every application's deployment descriptor.
 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Charles,

I did look up the default web.xml, i do not see a mapping for .jspf, i am pasting the servlet mapping section from the config file.



<!-- ================ Built In Servlet Mappings ========================-->


<!-- The servlet mappings for the built in servlets defined above. Note -->
<!-- that, by default, the CGI and SSI servlets are *not* mapped. You -->
<!-- must uncomment these mappings (or add them to your application's own -->
<!-- web.xml deployment descriptor) to enable these services -->

<!-- The mapping for the default servlet -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>

<!-- The mapping for the invoker servlet -->
<!--
<servlet-mapping>
<servlet-name>invoker</servlet-name>
<url-pattern>/servlet/*</url-pattern>
</servlet-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>

<!-- The mapping for the SSI servlet -->
<!--
<servlet-mapping>
<servlet-name>ssi</servlet-name>
<url-pattern>*.shtml</url-pattern>
</servlet-mapping>
-->

<!-- The mapping for the CGI Gateway servlet -->

<!--
<servlet-mapping>
<servlet-name>cgi</servlet-name>
<url-pattern>/cgi-bin/*</url-pattern>
</servlet-mapping>
-->

 
Reshma Shanbhag
Ranch Hand
Posts: 208
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I get it now, actually the .jspf inclusion works fine without mapping with include directive and include standard action with static content (though not the purpose of jsp:include).


So if any type of runtime processing is involved in the .jspf file this mapping is a must.


EX: When used jsp aram with include standard action it needs the mapping.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic