JSP template inheritance
You can use rapid-framework for JSP template inheritance
base.jsp
%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid" %> <html> <head> <rapid:block name="head"> base_head_content </rapid:block> </head> <body> <br /> <rapid:block name="content"> base_body_content </rapid:block> </body> </html>
child.jsp
<%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid" %> <rapid:override name="content"> <div> <h2>Entry one</h2> <p>This is my first entry.</p> </div></rapid:override> <!-- extends from base.jsp or <jsp:include page="base.jsp"> --> <%@ include file="base.jsp" %>
output
<html><head> base_head_content</head> <body> <br /> <div> <h2>Entry one</h2> <p>This is my first entry.</p> </div></body> </html>
source code