Java & J2EE Page 7 - Slapping Together A JSP Development Environment |
If you plan to use JSP to communicate with a database using a JDBC connection, there are a couple of additional things you need to do. First, get yourself a copy of the mm.mySQL module from http://www.worldserver.com/mm.mysql/ or http://mmmysql.sourceforge.net/ - this is required to communicate with the database. Extract the file "mysql.jar" from the archive, and place it in your JDK's LIB/ folder. Next, add the location of this file to the CLASSPATH variable. On Windows, use
and on Linux, use
Pop open your favourite text editor and create the following JSP file:
This is a simple JSP file to connect to a database, run a query and return the results. Remember to modify the database name, user details and query in the example above before proceeding. Finally, start up Tomcat, Apache and mySQL. Point your browser to the file you just created - say, http://localhost/examples/jsp/query.jsp and JSP should display the results of your query. And that's it. You now know how to set up a JSP development environment with minimum fuss and effort. Now get out there and show those kids how the pros do it!
blog comments powered by Disqus |