The following uses Tomcat as the JSP Engine and uses Tomcat, Apache, and IIS as the three Web servers to describe three solutions for setting up the JSP program running environment.
I. Introduction to related software
1. J2SDK: the software development tool of Java2, which is the basis of Java applications. JSP is based on Java technology, so you must install J2SDK before configuring the JSP environment.
2. Apache server: a common Web server developed by Apache to provide Web services.
3. Tomcat server: a JSP engine developed by Apache. It has the Web server function and can be used as an independent Web server. However, as a Web server, Tomcat does not process static HTML pages as quickly as Apache, nor is Apache robust. Therefore, we generally use Tomcat with Apache, apache provides services for website static page requests, while Tomcat, as a dedicated JSP Engine, provides JSP parsing for better performance. Tomcat itself is a sub-project of Apache, so Tomcat provides powerful support for Apache. Tomcat is a good choice for beginners.
4. mod_jk.dll: Developed by the Jakarta project team of Apache to support Tomcat plug-ins. With this plug-in, Tomcat can be seamlessly connected to Apache.
52.16tc4ntiis.zip: this plug-in is developed by the Jakarta project team of Apache to support Tomcat.
2. Software Download
1. j2sdk
Version: j2sdk1.4.1 (35.9 MB)
Address: http://java.sun.com/j2se/1.4.1/download.html
2. Apache2
Version: Apache2.0.436.69MB)
Address: http://www.apache.inetcosmos.org/dist/httpd/binaries/win32/
3. Tomcat4
Version: 4.1.218.33MB)
Address: http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/
4. mod_jk.dll: (136KB)
Address: http://jakarta.apache.org/builds/jakarta-tomcat-connectors/jk/release/
5366tc4ntiis.zip 220KB)
Address: http://members.ozemail.com.au /~ Lampante/howto/tomcat/iisnt/tc4ntiis.zip
The above are free software.
3. Preparations before configuration
1. Prepare a JSP webpage for testing
Open a text editor, such as Notepad, enter the following code, and save it as test. jsp. Note that the extension is. jsp ).
<HTML> <HEAD> <TITLE> JSP test page </TITLE> </HEAD> <BODY> <% out. println (" |
2. Install J2SDK
In either case, you must install J2SDK before installing and configuring the JSP Engine.
Install J2SDK
Run the j2sdk-00004_000001-windows-i586.exe file in windows and install it in a directory according to the installation wizard, for example, f:/j2sdk 1.4.1;
Add Environment Variables
1) if your operating system is Win 98, you can use NotePad to directly edit Autoexec. bat and add the following command line:
PATH = % PATH %; f:/j2sdk1.4.1/bin
SET JAVA_HOME = f:/j2sdk1.4.1
Set classpath = f:/j2sdk1.4.1/lib/tools. jar
After saving, restart the computer so that the added environment variables will be valid.
2) If your operating system is Win2000, configure the environment variables as follows. Right-click my computer and choose Properties> system features> advanced> environment variables from the shortcut menu. The environment variables dialog box is displayed, you can edit the environment variables of the system. Add three variables: PATH, JAVA_HOME, and CLASSPATH. The variable value is the same as the preceding one.
Iv. JSP environment configuration Scheme
Solution 1: J2SDK + Tomcat
In this solution, Tomcat serves as both a JSP engine and a Web server, and the configuration is relatively simple.
1. install Tomcat
Run the downloaded jakarta-tomcat-4.0.1.exe directly and install Tomcat according to the general installation steps of Windows programs. During installation, Tomcat is automatically located in J2SDK. For example, install it to f:/tomcat4.
2. Configure Tomcat Environment Variables
Add a new environment variable TOMCAT_HOME with the variable value f:/tomcat4. Add the same method as the J2SDK environment variable configuration method.
3. Test the default service
After setting, you can run the Tomcat server. Start Tomcat with f:/tomcat4/bin/startup.exe and disable Tomcat with f:/tomcat4/bin/shutdown.exe. If an Out of Environment Space error is prompted when startup.exeor shutdown.exe is executed, select "attribute" → "Memory" → "regular memory" in the menu of the DOS window ", change "initial environment" from "automatic" to "2816 .)
After Tomcat is started, open the browser and enter http: // localhost: 8080Tomcat in the address bar. The default port is 8080. If you see the welcome interface of Tomcat in the browser, Tomcat works normally.
- Fully use the tag function to compile JSP application JSTL)
- JSP line feed solution
- Simplified code in JSP expressions
- Analysis of JSP server
- Monitor JVM available memory in JSP