4.2.2 Implementation using JSP
Since the goal was to use JSP only for generating formatted output and providing a user
interface, particular attention was paid to placing the business logic in external classes (the
business logic layer will be discussed in Section 4.3). All JSP pages are implemented in a
common way. Therefore, just one example page is analyzed in detail below.
Presented here is the application form (file: application_int.jsp). The complete code for the page
is not shown; repetitive code segments have been removed. JSP language segments are
highlighted with a shaded background.
The beginning of the JSP page typically contains the HTML header. Also included here is the
link to the CSS style sheet to achieve the uniform font and color style.
Permit System New Application
Then, the page language is set and the required Java classes are imported using the JSP page
directive.
<%@ page language="java" import="java.sql.*,Permit.MyHTML,Permit.Company,
Permit.WorkType,Permit.StreetWorkType,Permit.Street"%>
The JSP include directive is used to include the banner to the page.
<%@ include file="../banner_permit.html" %>
The NavigationBar bean is instantiated, and the items that should be presented are added to
the navigation bar content. Then, the completed navigation bar is dumped on the page with the
evaluation of the toHTML() function.
<% navApplicationInt.add("Home","home_int.jsp"); %>
<% navApplicationInt.add("Permits Menu","permits_int.jsp"); %>
<% navApplicationInt.add("Help","help_int.jsp"); %>
<%= navApplicationInt.toHTML() %>
53
Java Web Hosting Application Development Using Java Technologies Hosting
|
|
|
|
TotalRoute.net Business web hosting division of Vision Web Hosting Inc. All rights reserved. |