Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Directory (?) [-]
- Common sense
- 1 War Pack
- 2 Tomcat Server
- Configuring the Java Runtime Environment
- 1 Download and install the JDK
- 2 Setting the JDK environment variable
- 3 Verify that the JDK environment variable is set successfully
- Deploying a Tomcat Server
- 1 Download tomcat to local hard drive
- 2 Setting Tomcat environment variables
- 3 Verify that the configuration of the Tomcat environment variable is successful
- Deploy the war package for the Web project to the Tomcat server
- 1 FTP Get War package and SQL script
- 2 Configuring the virtual directory for a Web project
- 3 Accessing the login page for a Web project
Reference Source:
Http://www.cnblogs.com/pannysp/archive/2012/03/07/2383364.html
1. Common sense:
1.1 War Pack
The war package is generally a web development, usually a Web site project under all the source of the collection, which contains the foreground HTML/CSS/JS code, also contains Java code.
When developers debug all the code on their own development machine and pass it, they need to package the developer's source code into a war for release to the testers and future product launches.
The war package can be placed under Tomcat under the WebApps or Word directory, which can be automatically decompressed as the Tomcat server starts.
1.2 Tomcat Server
Tomcat server is a free open source Web application server, belongs to the lightweight application server, in small and medium-sized systems and concurrent access users are not widely used, is the first choice to develop and debug JSP programs, The latest servlet and JSP specifications can always be seen in Tomcat.
2. Configure the Java Runtime Environment 2.1 Download and install the JDK
Download the latest JDK from the official website:http://java.sun.com/javase/downloads/index.jsp , install after download, select the directory where you want to install the JDK. The JRE is included in the JDK, so there is no need to install the JRE separately.
2.2 Setting the JDK environment variable
Right-click on "Computer", click "Properties", click "Advanced System Settings" on the left side of the pop-up window and select "Advanced environment variable" in the Pop-up tab.
Assume that your local Java JDK installation location is:C:\Program files\java\jdk1.7.0_45.
Here, create a new 2 environment variable and edit the 1 existing environment variables. As follows:
new variable name: java_home;
Variable Value: You install the JDK installation directory, here for C:\Program files\java\jdk1.7.0_45.
New variable name: CLASSPATH
Variable Value:
.; %java_home%\lib;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar;%tomcat_home%\bin
(Note that there is a. Number at the front)
To edit the path of an environment variable:
Variable name: Path;
Variable value:%java_home%\bin;%java_home%\jre\bin;
(Paste the string here to the front of the variable value)
2.3 Verify that the JDK environment variable is set successfully
Click Start and enter cmd, enter: Java at the command line; Javac Java–version.
If you display the following information separately, your Java environment variable is already configured successfully.
Enter Java to display:
Input Javac, display:
Input java–version, display:
3. Deploying the Tomcat Server
3.1 Download tomcat to local hard drive
Download the Tomcat server from the official web. The files downloaded on the official website are all green and free of installation.
As: http://tomcat.apache.org/download-70.cgi.
Unzip after download, such as E:\apache-tomcat-7.0.26.
3.2 Setting Tomcat environment variables
The Environment Variable dialog box that opens the computer is still the point.
Create a new environment variable:
Variable name: tomcat_home
Variable value: The directory after your Tomcat decompression, such as E:\apache-tomcat-7.0.26.
3.3 Verify that the configuration of the Tomcat environment variable is successful
Run the Bin/startup.bat in the Tomcat decompression directory to start the Tomcat server. Enter http://localhost:8080 in the address bar of any browser, indicating that Tomcat's environment variable is configured successfully if the interface is displayed as such.
The windows that Tomcat launches are:
4. Deploy the war package for the Web project to the Tomcat server
4.1 FTP for war packages and SQL scripts
Download daily building out of the latest project package from the local FTP server. After decompression is generally composed of two files, database folder and Projectname.war package.
By running the Xxxxx.sql script file in the database file, you can generate the most recent databases and table structure.
4.2 Configuring the virtual directory for a Web project
Copy the Projectname.war package to the webapp of Tomcat. When configured, the Access path is: http://localhost:8080/projectName/login.jsp.
Before accessing, you need to modify the configuration file of the Tomcat server to open:
Tomcat unzip directory \conf\context.xml. When you run the Web project, the database connection string that you want to configure is added to the XML file. The added context.xml are:
<Context>
<!--Default set of monitored resources--
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<!--uncomment this to disable session persistence across Tomcat restarts-
<!--
<manager pathname= ""/>
-
<!--uncomment this to enable Comet connection tacking (provides events
On session expiration as well as WebApp lifecycle)--
<!--
<valve classname= "Org.apache.catalina.valves.CometConnectionManagerValve"/>
-
(This is the database configuration that needs to be connected when this Web project is run.) )
</Context>
4.3 Accessing the login page for a Web project
Once the connection string is set up, you can access the Web project based on the Tomcat server.
First run the Startup.bat in the Tomcat bin directory, and when Tomcat is started,
When the browser enters: localhost:8080/projectname/login.jsp, the login interface for the Web project appears, indicating that the war package was successfully deployed to the Tomcat server and successfully accessed.
Source: http://blog.csdn.net/inter_peng/article/details/42833587
Deploy Web projects to Tomocat