- Page 1 of 42 -
Bert Torfs Page 1 02-02-2003
Introduction....................................................................................................................................................................... 2
Environment ...................................................................................................................................................................... 2
DOWNLOAD J2EE.......................................................................................................................................................... 3
Eclipse................................................................................................................................................................................ 3
Download and install...................................................................................................................................................... 3
Create a simple HelloWorld program.............................................................................................................................. 3
JBoss .................................................................................................................................................................................. 6
Download and install...................................................................................................................................................... 6
Configuring Eclipse to work with JBoss .......................................................................................................................... 7
‘HelloWorld’ as a stateless session EJB. ........................................................................................................................... 8
Introduction............................................................................................................................................................... 8
Make a new project for our server code. ...................................................................................................................... 8
Make the sessionbean.................................................................................................................................................. 8
Create the remote interface ......................................................................................................................................... 9
Create the home interface ........................................................................................................................................... 9
Package the bean into a JAR to be deployed on JBoss.................................................................................................. 9
Deploying the bean................................................................................................................................................... 10
Changing our client to use the bean .......................................................................................................................... 11
Running and debugging............................................................................................................................................ 12
Accessing a database.......................................................................................................................................................... 13
Introduction................................................................................................................................................................. 13
MySql .......................................................................................................................................................................... 13
JDBC Driver for MySql :.............................................................................................................................................. 16
Download and install ANT........................................................................................................................................... 16
Middlegen : generate EJB ............................................................................................................................................. 17
Adapting config/database/mysql.xml......................................................................................................................... 17
Adapt Build.xml ....................................................................................................................................................... 17
Generate EJB’s.......................................................................................................................................................... 19
Back to eclipse : update the server application to read the database ................................................................................ 20
Add the beans to the project ..................................................................................................................................... 20
Modify the session bean to get its data from the entity beans ..................................................................................... 21
Modify, run and debug the client.............................................................................................................................. 24
JSP................................................................................................................................................................................... 26
Required setup ............................................................................................................................................................. 26
Download and install Apache Tomcat....................................................................................................................... 26
Download and install ‘Sysdeo Eclipse Tomcat Launcher plugin’................................................................................ 27
Download and install ‘Solar Eclipse’.......................................................................................................................... 28
A Simple JSP example : WhatTimeIsIt.......................................................................................................................... 29
Building and debugging a lot-of-tiers J2EE web application .............................................................................................. 33
View-Controller (the model will come later) ................................................................................................................. 33
A first view ............................................................................................................................................................... 33
Some More Views (we would not need a controller otherwise) .................................................................................. 34
Then comes the controller ........................................................................................................................................ 36
Add the Model ......................................................................................................................................................... 42
Store and get preferences and settings in XML files ........................................................................................................... 42
What’s next ...................................................................................................................................................................... 42