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

Creating, Installing, and Running a JSP Page

You can create a JSP page with a regular text editor. A JSP page should have the file extension .jsp, which tells the server that the page needs to be processed by the JSP container. Without this clue, the server is unable to distinguish a JSP page from any other type of file and sends it unprocessed to the browser.

JSP pages are requested directly from a browser (although the container intercepts the request and does its magic before the response is returned); you must place the page in the public part of the WAR structure. For instance, the page in Example 4-3 is contained in the easy.jsp file in the top directory of the WAR for the book examples:

/cover.gif
/easy.jsp
/footer.jsp
/index.html
/expense/reports.jsp
...
/WEB-INF/web.xml
/WEB-INF/classes/JSPSourceServlet.class
...
/WEB-INF/lib/commons-logging.jar
/WEB-INF/lib/jsf-api.jar
/WEB-INF/lib/jsf-impl.jar
/WEB-INF/lib/jsfbook.jar
/WEB-INF/lib/jstl.jar
/WEB-INF/lib/standard.jar
...

If the page uses actions from a custom tag library, you must also install the tag library. The page in Example 4-3 uses actions from the JSTL core library, so I use this library as an example here. Be aware, though, that because JSTL is defined by a public specification, a web container may bundle a shared implementation of the JSTL tag libraries so you don’t have to install them for each application. A true custom library, e.g., one developed in-house, must always be installed, though.

Installing a custom ...

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