Some experiences on JSP Model 2 workflow
Since we use the frame structure of JSP Model 2, the various servlets play a C (ontroller) role in the MVC structure of JSP Model 2, so we use the following steps to complete a typical JSP Model 2 call process:
1. Get the environmental parameters required to obtain the database connection (using Ecampus.Util.env (String FileName) in the Servlet's init (). Note: Since the XML Config module is not completed, temporarily use the INI file
2. Servlet gets a service request from HTML / JSP and gets a Connection in the corresponding Doxxx () (calling the static method of eCampus.util.dbManager). Note: A DBManager class is encapsulated in Package Ecampus.util, using this type of static method getConnection () and getPooleConnection () can obtain direct JDBC connecting from the database and connected through the WebSphere connection pool (recommended latter ).
3. Use this Connection to perform JDBC operations, or initialize a database transaction JavaBean (incoming this Connection into the JavaBean constructor).
4. After completing the JDBC operation, including the database transaction JavaBean returns the result, turn off the Connection obtained by step 2.
5. Pack the database operation result in the corresponding data javabean, distribute this JavaBean to the corresponding JSP page (the JSP page plays the V (IEW) role in the MVC).
6. The JSP page gets the packaged data JavaBean, extracts the required information, and outputs it to the user's browser according to certain styles.