Java Reference
In-Depth Information
<input type=" button" value="Update"
onClick=" eventValidateAndSubmit ('UWR002','SCR001')"/>
The controller used this combination of event code and screen code to uniquely
identify a block of code to be executed for each user action and subsequent selection of
the next view to be rendered. This controller was another JSP and was cluttered with sev-
eral long-running if-else blocks, as shown in Listing 3-2.
Listing 3-2. UnderwritingController.jsp
String eventCode = request.getParameter("eventCode");
String screenCode = request.getParameter("screenCode");
String inputPage = request.getParameter("referrer");
Sting userCd = request.getParameter("userCode");
String nextView = "";
SecurityChecker.getInstance().check(userCd, eventCode);
if(screenCode.equals("SCR001") && eventCode.equals("UWR002")){
//Look up session bean
//Create policy by invoking session bean method
nextView = "Policy.jsp";
else if(screenCode.equals("UWR002") && eventCode.equals("SCR001")){
//similar to above
nextView = "Policy.jsp";
"You have attempted an unsupported function");
nextView = "error.jsp";
catch(AppException appExp){
nextView = inputPage;
catch(Throwable exp){
Search WWH ::

Custom Search