Java Reference
In-Depth Information
Listing 3-51. WEB-INF/jsp/createPolicy.jsp
<%@ taglib prefix="form" uri="" %>
<%@ taglib prefix="c" uri="" %>
<%@ taglib prefix="fmt" uri="" %>
.error { color: red; }
<form:form action="" method="POST" commandName="policydetails">
First Name <form:input path="firstName"/> <form:errors path="firstName"
Last Name <form:input path="lastName"/> <form:errors path="lastName"
Age <form:input path="age"/> <form:errors path="age" cssClass="error"/><br/>
Product Code <form:select path="productCodeList" items="${productCodeList}"/>
<form:errors path="productCodeList" cssClass="error"/><br/>
<input type="submit" value="Save" />
A list of product code is prepopulated and cached at application startup. It is
retrieved and supplied in the form bean by the controller (see in Listing 3-52) by
overriding the formBackingObject method.
Listing 3-52.
public class SaveNewPolicyController extends SimpleFormController {
private UnderWritingBusinessDelegate uwrBusinessDelegate;
protected void doSubmitAction(Object formbean) throws Exception {
PolicyFormBean policyBean = (PolicyFormBean)formbean;
Search WWH ::

Custom Search