|
|
Let's make a quick and dirty database connection with JSPs and Apache Tomcat.
-
If you wish, make this a JSP, Servlet, or even a Swing application outside
of Tomcat. Do what is comfortable to you. I'm going to try
a JSP because it's not too difficult. It's quick and dirty because
we are not going into the details of a JSP. But, if you have not
had exposure to JSP in the past and have any questions about the process,
please let me know.
-
Steps (not confirmed)
-
Install Tomcat 4.x.
-
Make a new directory under webapps with the name of your app.
-
Create a web-inf folder under that, put a web.xml file in it with the bare
minimum tags.
-
Create your JSP in the application directory.
-
Make a lib directory off of WEB-INF, put Connector/J in it. (First
test: use AT 4.0, then lib. Move this to app lib when proven.)
-
Put the connection statements in your JSP page.
-
Import the appropriate packages: java.sql and the like.
-
Put in the connection statements (explained in detail in further slides).
See the JSP Source that I used, along with a screen
capture of the output.
|