In web development, the duplication of web code is an unavoidable problem. We do the site, all the pages will have a more unified page layout, only with the data-related parts will be different. If each page contains complete HTML code, it will cause a lot of duplicate code, and in the modification of those public parts (such as the page header and the end of the page), it is very troublesome to modify multiple pages.
Of course, there are many ways to solve this problem, in the ASP.net, there is a mechanism called the motherboard can do, in Java development, there are many ways, the simplest is to use in the JSP file with the include directive, you can also use a lot of other Third-party template library.
I am using the tiles template engine, tiles is a component of struts, so when used in SpringSide2.0, do not need to download third-party components, and do not need additional configuration, directly use the line.
For example, in my website, my welcome.jsp layout diagram is as follows:
The layout of my user registration page reguserstep1.jsp is as follows: