I am new to JSP. When I used to work with ASPX I created a project with a master page, the <body> of the master page was like this:
<body>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
</body>
and every ASPX file except the master had in the beginning MasterPageFile="~/Site.master" for example
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
and wrote only in MainContent like this:
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent">
code ...
</asp:Content>
Now I want to create same idea in JSP. How can I define the master and how I can define that the other JSP will be under the control of the master`?
check this link: http://code.google.com/p/jsp-decorator/
You can have a decorator – the master – for the pages that you want.
I use an
xmlto define which page has which decorator, something like:See the answers to this question: Is it possible to define a decorator directly in a JSP with Sitemesh?