|
1
|
|
|
2
|
|
|
3
|
|
|
4
|
|
|
5
|
|
|
6
|
|
|
7
|
|
|
8
|
|
|
9
|
|
|
10
|
|
|
11
|
|
|
12
|
|
|
13
|
|
|
14
|
|
|
15
|
|
|
16
|
|
|
17
|
|
|
18
|
|
|
19
|
|
|
20
|
|
|
21
|
|
|
22
|
|
|
23
|
|
|
24
|
- Install WebLogic Workshop
- Build the Login page according to the section material
- Add Product and Registration pages
- Prepare SQL statements for existing data and store as files
- in the “sqlLocation” that is set in the web.xml and
MyServletContectListener
- (No SQL is needed if application creates data from scratch)
- Create bean classes like the LoginBean that support data structures used
with data access and in the forms.
- Create the LoginController with the checkLogin() method.
- Note, that the data access in the controller is performed with the
DataService.getData() method that uses the SQL statement-file
“getLogin.sql” stored in the “sqlLocation”
- Prepare HashMap to replace SQL <<keys>> with run-time values
|
|
25
|
- Include the library “com.its.util.jar” in the CLASSPATH and import
com.its.util.DataService
- @param directoryName to set the location where your SQL statement files
are stored
- public static void setSqlLocation(String directoryName)
- @param driverName your jdbc driver name
- public static void setDriverName(String driverName)
- @param set Connection URL for database access
- public static void setConURL(String connectionURL)
- // execute insert/delete/update SQL statements stored in the
“sqlLocation”
- @ param sqlStatementName for example “getLogin” stored as the
“getLogin.sql”
- @ param map of key-values to replace SQL <<keys>> with
run-time values
- @ return numberOfRowsEffected
- public static int setData(String sqlStatementName, HashMap map)
- @ param sqlStatementName for example “getLogin” stored as the
“getLogin.sql”
- @ param map of key-values to replace SQL <<keys>> with
run-time values
- @ param beanClass (e.g. LoginBean.class) supports records retrieved by
the SQL statement
- @ return list of objects of the beanClass
- public static List getData(String sqlStatementName, HashMap map, Class
beanClass)
- @param dataSource your DataSource specified in JNDI context
- public static void setDataSource(DataSource dataSource)
|
|
26
|
|
|
27
|
|