[转]JSP layout最佳实践

源地址:stackoverflow

Put the following in WEB-INF/tags/genericpage.tag

<%@tag description="Overall Page template" pageEncoding="UTF-8"%>
<%@attribute name="header" fragment="true" %>
<%@attribute name="footer" fragment="true" %>






To use this:

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib prefix="t" tagdir="/WEB-INF/tags" %>

<t:genericpage>
<jsp:attribute name="header">

Welcome


</jsp:attribute>
<jsp:attribute name="footer">

</jsp:attribute>
jsp:body

Hi I'm the heart of the message


</jsp:body>
</t:genericpage>

That does exactly what you think it does!

posted @ 2017-10-17 22:46  linden5  阅读(123)  评论(0)    收藏  举报