Java Reference
In-Depth Information
Strategies with the Spring Framework
This pattern separates out the logic for retrieving and processing model data from the
static markup in the JSPs. It can optionally format data types such as date and currency,
depending on the locale. As shown in Figure 3-15, it should be used as a thin layer to
adapt model data into views. Note that view helpers should not be responsible for invok-
ing business or data access logic.
Figure 3-15. Working of a view helper
JavaBeans View Helper
This is the simplest form of view helper strategy. JSP provides out-of-the-box tags to
support POJO view helpers. Listing 3-46 shows that policydetails.jsp is using the
PolicyDetail POJO as the JavaBean view helper.
Listing 3-46. policydetails.jsp
<jsp:useBean id="policydetails" scope="request"
class="com.apress.insurance.common.dataholder.PolicyDetail"/>
<html>
<head>
<title>Underwriting</title>
<script>
function eventSubmit(url){
document.policy.action = url;
 
Search WWH ::




Custom Search