This article is the first part of the new JSP Best Practices series, which describes the JavaServer Pages include mechanism. Follow the Java programming expert Brett McLaughlin Learn how to use include to add static header and footer files to your Web site or Web application page.
Welcome to the latest best practices series in the Java area. If you've seen a series of previous articles, you'll know that best practices are designed to give you a quick look at useful aspects of various Java technologies. This series of best practices deals specifically with JavaServer Pages (JSP) technology, which is one of the core Java EE technologies.
In short, JSP technology is a tool for building Web pages or Web application interfaces on a Java platform. JSP technology allows us to do the following things: Dynamic response request data, display complex XML and HTML, and create lively and interesting, dynamic-driven Web sites. In this series, you'll learn the basics of building a Web site with JSP technology. I'll introduce you to the most commonly used JSP mechanisms, where you'll learn about basic WEB development technologies, such as making templates, manipulating dynamic content, image hosting, creating a library of utility code, and so on.
This is the first of a series of articles, and in this article we will focus on the JSP include mechanism, which allows us to "pull" the contents of the local HTML page. We'll start with some background information on Web page include development, especially the use of framework and server-side include. Then, I'll show you how to use the JSP include mechanism to add a unified header file and footer file to a Web page or Web application screen.
JSP Best Practice Series
This series of articles is not intended to be a complete introduction to JSP technology, nor is it intended as a guide for building special types of applications. Instead, each part of the series focuses on one aspect of programming with JSP technology, dividing it into small fragments. See the Resources section for a more extensive introduction to JSP technology or a more in-depth study of how to use it for special results.
What you will need
All the best practices in this series are based on the JavaServer Pages technology. To run any practice, you need to set up a JSP-compliant Web container on the local machine or test server, such as Apache Tomcat. You also need to write JSP page code using a text editor or IDE. See Resources for a link to a list of Tomcat and JSP-compatible Web containers and Ides.
A better look
Creating a consistent design and layout for your Web pages is one of the easiest ways to ensure a professional look. You may have seen enough sites to know that most of the pages in a single site share a common page header, footer, and some kind of navigation bar. On well-designed sites, these elements will render the same layout, content, and functionality on each page, and the main panel (often called the content pane) will change with each view.
Previously, this layout was almost entirely implemented by the framework and frameset. Each piece of static content is placed in a frame, and the main content of the page is placed in the middle frame. The trouble with the framework is that different browsers often display them in different ways, making them look inconsistent. Using frames to link external sites from internal pages is more difficult than you might think. It was intended to allow users to view external content without leaving the site, but the results were often inconsistent. The user ultimately sees the entire site being squeezed into a much smaller framework, and, worse, your site will eventually be nested within another site framework. This confusion drives Web designers to find a better solution. Server-side include (Server-side Include,ssi) is a.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.