1. Install JDK
sudo apt-get install OPENJDK-6-JDK
2. Install Apache2
sudo apt-get install apache2
3. Install MySQL
(1) Installation
sudo apt-get install Mysql-sql
(2) Creating databases and tables
Mysql-uroot-p
4. Install Tomcat
(1) Installation
Download the tar.gz file in the core in the Http://tomcat.apache.org/download-60.cgi page, and after the decompression, remove the unpacked folder (renamed Apache) to the/usr/local.
(2) Start Tomcat
Perform/usr/local/apache/bin/startup.sh at terminal
5. Use JDBC in JSP to connect to MySQL database
(1) Download JDBC Driver
Www.mysql.com/downloads/looking for connectors, and then the left side of the page there are connector/j clicks will appear for the selection of tar.gz and zip file download (download. tar.gz file), download after the decompression.
(2) Configure connection files
Copy the Mysql-connector-java-5.1.18-bin.jar files from the mysql-connector-java-5.1.18 you just expanded to the installed JDK and the Lib folder under Tomcat:
Jdk:/usr/lib/jvm/java-6-openjdk/lib
tomcat:/usr/local/apache-tomcat-6.0.35/lib/
6. Test files
(1) Create test Site
Create a table of contents:/usr/local/apache/lib/apache/webapps/test
Copy the/usr/local/apache/lib/apache/webapps/root/web-inf directory to the/usr/local/apache/lib/apache/webapps/test.
(2) Create test file
Create file:/usr/local/apache/lib/apache/webapps/test/test.jsp
<%@ page contenttype= "text/html; Charset=utf-8 "import=" java.util.* "%>
<%@ page import= "java.sql.*"%>
<title>
Test
</title>
<body bgcolor= "#ffffff" >
<center>
<% out.print ("HelloWorld"); %>
</center>
</body>
7. View results:
In the browser address bar, enter: localhost:8080/test/test.jsp to see if the page shows the data in the corresponding database.