Uh. yeah. We did say it's a *convention*... we just forgot to point out that it doesn't work automatically by default, unless you provide a servlet mapping to tell the Container that it should treat every thing with a .jspf extension as a JSP.
To do this mapping, you need to create a servlet mapping in which the servlet NAME is "jsp" all lower case and the url pattern is *.jspf. This tells the Container that everytime it sees a request for a .jspf thing, it is to treat this as a JSP and do the translation (which of course it does automatically with a *.jsp extension.
So, it's a convention (although not everyone uses it, and here's a perfect example of WHY), but it doesn't happen by default. So, you could use any extension you like, as long as you tell the Container using a mapping to show that, "Hey, this thing over here is to be treated as a JSP for the purposes of translation."
The reason that some people use .jspf instead of .jsp, is to make it explicit that this is a "segment" (used to be called "fragment", hence the "f" at the end), which means it should NOT have opening and closing tags, for example. Sorry about the confusion!
Geez Roger, you're smoking them ALL out! I'm predicting another successful exam for you...
Joined: Aug 31, 2004
Thanks again Kathy!
I've gone back to .jspf now and added the servlet mapping as you mentioned, (making sure I removed the 'deployed' .jsp of course!) and all works as designed!
It hadn't occurred to me that you could use a servlet mapping independently of a servlet entry. A neat trick!
All this, and I still only got 10/18 at the end of the chapter! That's a warning I need to brush up on my EL a bit more! Incidentally, questions 2 and 6 use a single "'" for the el expressions, but it isn't until the next chapter that there's a comment saying that you can use either ' or " - meanie . (I nearly lost more points for assuming that they were invalid, but decided that, seeing how forgiving EL seemed to be, it'd probably allow it).