Always maintain HttpSessions
Prefer JSTL tags
Prevent self linking
A Web App Framework WEB4J
If using JSPs, templates can be easily implemented using either the
<@include>
directive or the <jsp:include>
action.
<jsp:include>
inserts the main content or "body" of the page.
There are two parameters to the template, which are passed in as request parameters :
TTitle
, used in the <title>
tagTBody
, which is simply the name of the JSP which supplies all page content not otherwise defined
in the template.<tags:xxx/>
items refer to .tag
files, that contain small JSP snippets.
<%@ include file="/JspHeader.jsp" %> <!doctype html> <html lang='en'> <head> <meta http-equiv="Content-Type" content="text/html; charset=uTF-8"> <%-- TTitle is a request parameter for the templated page title. --%> <title> Fish and Chips Club - ${param.TTitle} </title> <link rel="stylesheet" type="text/css" href="../../stylesheet.css" media="all"> </head> <body> <div align="center"> <img class="no-margin" src="../../images/logo.jpg" alt="Fish And Chips Club"> </div> <div class="header"> "The Total Fish & Chips Dining Experience" </div> <div class="menu-bar"> <w:highlightCurrentPage styleClass='highlight'> <c:url value="/main/home/HomePageAction.do" var="homeURL"/> <A href='${homeURL}'>Home</a> <c:url value="/main/rsvp/RsvpShow.do" var="showRsvpURL"/> <A href='${showRsvpURL}'>Rsvp</a> <c:url value="/all/logoff/LogoffAction.do" var="logoffURL"/> <A href='${logoffURL}'>Log Off</a> </w:highlightCurrentPage> </div> <%-- Display error and information messages. --%> <tags:displayMessages/> <%-- TBody is a request parameter for the templated page body. --%> <div class="body"> <c:if test="${not empty param.TBody}"> <jsp:include page='${param.TBody}' flush="true"/> </c:if> <c:if test="${empty param.TBody}"> <jsp:include page="Error.jsp" flush="true"/> </c:if> </div> <tags:footer/> </body> </html>