Adding jstl and jsp related dependency jars, Enhancing the controller – HP Integrity NonStop J-Series User Manual
Page 60

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
"http://www.w3.org/TR/html4/loose.dtd">
<%@ include file="/WEB-INF/jsp/include.jsp" %>
We
lcome to the EmpInfo Application
Enter Employee Details
Adding JSTL and JSP Related Dependency JARs
Add the following JSTL and JSP dependency JAR files to the EmpInfo project in Eclipse:
Table 11 JSTL and JSP Dependency JAR Files
Dependency JAR Files
com.springsource.javax.servlet.jsp.jstl-1.1.2.jar
com.springsource.org.apache.taglibs.standard-1.1.2.jar
NOTE:
All the jar files mentioned in the above table can be found in the following spring
repository:
To add the dependency JAR files in the project library path and to resolve the J2EE module
dependency on these JARs, follow the instructions described in
“Adding Dependency JAR Files in
the Project Library Path” (page 52)
Enhancing the Controller
To add more functionality to the controller class, complete the following steps:
1.
Update the EmployeeController.java by setting the resource reference of the view to
its new location EmpInfo/WebContent/WEB-INF/jsp/insert.jsp. Set the key/value
pair for the current date and time value in the model with the key identifier: "now" and the
string value: 'now' as shown below:
Before modification:
logger.info("Returning hello view");
return new ModelAndView("insert.jsp");
After modification:
String now = (new Date()).toString();
logger.info("Returning view with " + now);
return new ModelAndView("WEB-INF/jsp/insert.jsp", "now", now);
2.
Add the following import statement:
import java.util.Date;
After modification, the controller file EmployeeController.java appears as:
package com.hp.empinfo.web;
import org.springframework.web.servlet.mvc.SimpleFormController;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
60
Spring Framework