Next, we need to create a JDBC connection with the Oracle database.
Select View>Database Navigator to display the Database Navigator.
Right-click on the Ajax4jsf node in the Databases Navigator and select
New Connection. In the Create Database Connection window specify a
Connection Name and select Connection Type as Oracle (JDBC).
Specify Username as OE and the Password for the OE user. In the
Oracle (JDBC) Settings window select the thin Driver. Specify Host
Name as localhost and JDBC Port as 1521. Specify SID as ORCL.
Click on Test Connection to test the connection. Click on OK to
configure the connection as shown in Fig. 7.11.
Fig. 7.11 Creating a JDBC Connection
7.4 Creating an Ajax4jsf Application 143
A connection gets added to the Database Navigator as shown in Fig.
7.12.
Fig. 7.12 JDBC Connection for Ajax4jsf Application
To the web.xml file add a resource-ref element for the Oracle
datasource. Add an ajax4jsf filter and filter mapping to web.xml.
Also specify a listener class. The web.xml file is shown in following
listing.
xmlns:xsi=???http://www.w3.org/2001/XMLSchema-instance???
xsi:schemaLocation=???http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd???
version=???2.4???
xmlns=???http://java.sun.com/xml/ns/j2ee???>
Empty web.xml file for Web
Application
javax.
Pages:
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134