Edit: This question was asked in response to incorrect observations I made. Please disregard.
I know that JSPFs are used to define fragments that can be included inside JSPs.
Beyond this convention, are there differences in how the server (eg Tomcat) or the user-agent (eg firefox, google bot, etc) might treat a file?
Our website has a few popups / dialog boxes that are loaded via AJAX. The content for most of these are stored inside JSPFs, and referenced in the url (eg, http://www.domain.com/folder/file.jspf). Recently we found that if the popup was inside a JSP instead, it would behave differently in the following ways:
1) Google would index it as a standalone page.
2) jQuery's $(document).ready(function() {alert('this code is executed')}); never runs.
First of all, the browser handles neither JSP nor JSPF files directly.
Instead, the browser requests a resource by URL and the server (in your case, Tomcat) responds with a document in HTML format.
Yes, you asked for a
.jspresource, but the server compiled the page and Tomcat produced HTML output to the browser.At that moment, the browser handled a plain HTML page.
I do see a potential problem with directly-accessing a JSPF file via a URL. Fragments should be included by a special JSP directive:
include. SeeUse of Composite View Patternsin Code conventions