As all may know, one of the main disadvantage of Java over C# programming using Visual Studio, is the use of Master Pages. Master Pages allow any developer to create the desired layout of the site. Any page created given that master page will inherit that same design and simply add the content to it. Now, in JAVA this is not possible. This brings along the redundant amount of data replicated on each page within a website. It is very time consuming since a change in design requires a change in all pages.
A tool very useful which may be the closest thing to Master Pages, is the use of Includes in JSP pages. The Include tag allows any page to be inserted into a page. Therefore lets say we would like to create this page:
Steps in Using Includes Tags:
Create New JSP page and Name Header.jsp
In the header jsp you may include all the divs and styles (logo, text, etc) without any <html> starting or closing tags. So, the header.jsp content should look like this:
Logo | some text here
link 1 | link 2 | link 3
Another Page may be created for the footer and be named footer.jsp containing the <div> or content it may require.
Create the actual index page and put all together. This is done by writing the includes tag wherever you need the pages to be shown. Between the <body> tags in this case we shall include the header and footer by:
<div> Content Here Depending on Page </div>
Any References or java script may also be included between the <head> tags.
P.S In the event you would like a LeftPane.jsp the main page would look like:
<div style=”float:right;”> Content Here Depending on Page </div>
Enjoy working with Java “Master Pages”