What is the .jspf extension? How to compile it?

What are .jspf files in JSP? As I know, the compiler will look for .jsp files to compile, how are the .jspf files compiled?

+78
java jsp jsp-fragments
Jan 17 '10 at 12:54
source share
5 answers

As others have noted, .jspf files are JSP fragments. They are intended to be statically included in another JSP file that is not compiled on its own:

<%@include file="/WEB-INF/jspf/example.jspf" %> 

You will notice that this example comes from the directory /WEB-INF/jspf . This means that it is not available outside the web application; there is no way to create a url that can get it. If you put them in the same directory as the "regular" JSP files, you can create such a URL; Tomcat, for example, will retrieve the page as a text document. However, the front-end web server may block these URLs.

I like JSPF files as a first step in refactoring large JSP pages . Since they are statically included, you can extract a small fragment of the file without providing scripts or variables, which leads to pages that are somewhat more convenient to maintain (and I want to emphasize that this is the first step: dynamic inclusion and taglibs are usually the best long-term solution). When refactoring, I find the fragments are close to their parent files; this is when using a web server to block URLs becomes useful.

+110
Jan 17 '10 at 13:16
source share

JSP Snippets can be compared to the back end. These fragments are not compiled on their own, however they are compiled with the page on which it is included. If I have to display different pages based on user preferences, I will choose jspf.

+8
Sep 05 '11 at 16:52
source share

What: .jspf files are usually files that are included in .jsp files through the include directive. "F" means "fragment" because these files themselves are not full JSPs.

How to compile: Since .jspf is a jsp fragment, therefore, it may not be a complete and compiled source, so most of the time it cannot be compiled independently of the other, the source that refers to them.

Source: Ibm Info Center

+5
Jul 27 '12 at 9:25
source share

IBM says .jspf is for JSP fragments. A fragment cannot be a complete and compiled source, so they probably cannot be compiled independently of another, full source that refers to them.

They are referenced in Sun developer resources in the same context - the naming convention for JSP snippets.

+3
Jan 17 '10 at 12:57
source share

In many web infrastructures, you can assemble views and pages from smaller, general views and pages. Using JSPs, these smaller fragments are called fragments. As the name suggests, they are not necessarily a complete representation without any larger context.

Other languages ​​and frameworks have their own term for an equivalent concept. For example, in Ruby on Rails they are called partial.

+2
Jan 17 '10 at 13:01
source share



All Articles