O'Reilly logo

JavaServer Faces by Hans Bergsten

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 12. Odds and Ends

At this point, we've developed most of the expense report application and discussed many JSF features along the way. But I've left out a few that don't fit the scope of the preceding chapters, and some that are not needed for the sample application but may be useful in other applications. I discuss most of these features in this chapter and cover the rest in the remaining chapters.

Building a View from Many JSP Files

In the preceding chapters, we've worked with the different areas of the sample application as separate pages. Besides making it easier to explain the features one by one without overwhelming you with unrelated details, this approach also make sense for developing a real application, because you can work with smaller files that are easier to grasp and debug. At some point, though, you need to put all the pieces together. There are two ways to build up a JSF view from multiple JSP files: statically include all pieces into one file when the JSP page is transformed into a servlet and compiled, or dynamically include the files each time the main file is requested.

The JSP include directive (<%@ include file="..." %>) supports the static include option. It includes the contents of the specified file, whether it's a file with just plain markup elements or a file with JSP elements. Because the include is processed when the page is transformed into a servlet, the name of the file to include must be entered as a static value. When a JSP file is included ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required