timesheetlist.jsp: Switch to Include File and Displaytag


To centralize the JSP code that displays error and status messages, we moved it to includemessage.jsp:

<%@ taglib prefix="display" uri="http://displaytag.sf.net/el" %> ... <%@ include file="/WEB-INF/jsp/includemessages.jsp" %> ...


Furthermore, to gain sorting capabilities in our web user interface, we switched from JSTL's C:forEach to Displaytag tag library. This not only demonstrates refactoring, but also the benefit of the Model-View-Controller (MVC) design patternthat is, our view code changed but the model was not affected:

<display:table name="timesheets"  defaultsort="1"                requestURI="timesheetlist.htm"                cellpadding="5" cellspacing="0"                export="false" > <display:column sortable="true" title="Period Ending"                 href="enterhours.htm"                 sortProperty="periodEndingDate"                 param paramProperty="timesheetId"                 >       <fmt:formatDate value="${timesheet.periodEndingDate}"                       type="date" pattern="MM/dd/yyyy"/>   </display:column>   <display:column sortable="true" title="Hours"                   sortProperty="totalMinutes" >       <fmt:formatNumber value="${timesheet.totalMinutes / 60.0}"                         pattern="0.00"/>   </display:column> ...




Agile Java Development with Spring, Hibernate and Eclipse
Agile Java Development with Spring, Hibernate and Eclipse
ISBN: 0672328968
EAN: 2147483647
Year: 2006
Pages: 219

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net