<p>Please enter your username and password to access the application</
<%@ include file="WEB-INF/jspf/loginform.jspf" %>
The include directive inserts the contents of the JSP fragment into our page. The
value of its file attribute is a relative path to the file we want to include. When the
page is rendered in the browser, the contents of the included file are placed where
we placed our include directive.
Ctrl+space code completion works between the double quotes for the file
After making this change in loginerror.jsp , we have successfully extracted the
common markup between both pages in to a single JSP fragment. Our application
will behave exactly as it did before, but it is now more maintainable since changes to
the HTML form have to be done only once.
In this chapter we covered how to develop JavaServer Pages (JSPs) to display both
static and dynamic content in a web browser.
We also saw how to implement the Model-View-Controller design pattern by using
JavaBeans as the model component, JSPs as the view and servlets as controllers.
Additionally, we learned how to secure web applications via form-based
authentication. We also covered how to extract common markup across pages into
a single JSP fragment, easing maintenance of web applications.