1. Installation
1. Install JDK first. Take the Windows NT environment as an example. The downloadable version of JSDK is an installable compressed file that provides a complete Java development environment, this allows you to build a Java solution that uses standard APIs as the core. Run the downloaded jdk1_2_2-win.exe file and follow the prompts to complete the installation. However, the only thing your server needs to apply to JSP is the Java compiler. Let the server know the location of the compiler.
2. modify the system environment parameters. JDK can be Sun JDK1.2.2 or 1.3, IBM JDK1.1.7 or Blueprints JDK. If you are installing JDK on Windows 98, set JAVA_HOME = [x:] jdk1.2.2 (where [x:] is the hard drive c:, d: and so on for JDK installation .) Add to your autoexec. bat; for Windows NT, you can select the path parameter on the control panel/system/environment page and add [x:] jdk1.2.2in; you can also add the new environment parameter CLASSPATH = [x:] jdk1.2.2libools. jar, and then reboot.
3. Install JSWDK. You only need to release the jswdk1_0_1-win.zip directory to the root directory of the hard disk (c:, d:, etc.), then you can find the jswdk-1.0.1 directory on the hard disk, if you do not want to retain JSWDK in the future, you can delete this directory without any system files or registry omissions.
For more information about the installation process and JDK under Solaris/Unix and Linux, see the installation instructions in the downloaded package. It is worth mentioning that reading readme and other files carefully before installation is a good habit.
Ii. Configuration
To execute JSP code, you must install the JSP engine on the server. Here we use Sun's assumerver Web Development Kit (JSWDK ). For ease of learning, this software package provides a large number of examples that can be modified. After JSWDK is installed, run the startserver. bat command to start the server. In the default configuration, the server port is 8080 and http: // localhost: 8080 is used to open the corresponding index.html page. If it can be opened successfully, the configuration is successfully completed, the real JSP journey can begin.
Note that after each boot, you must execute startserver. bat to start the jsp server. This is a program running in the DOS window. to exit, you can run stopserver. bat.
(For unix systems, run % startserver and stopserver respectively .)
If a problem occurs, the biggest possibility is that the JDK environment parameters are not correctly set. You can check them again.
If port 8080 has been requisitioned, you can open webserver. xml in the jswdk directory to reset the port. (In fact, this file contains all the configurations .) The details are as follows:
<WebServer id = "webServer">
<Service id = "service0" port = "8080">
<WebApplication id = "examples" mapping = "/examples" docBase = "examples"/>
</Service>
</WebServer>
Set the port to another port.
Open the jsp page through http: // localhost: 8080/examples/xxx. jsp
If you want to create your own execution directory, you can add the following settings in the webserver. xml file:
<WebApplication id = "myweb" mapping = "/myweb" docBase = "myweb"/>
Open the jsp page through http: // localhost: 8080/myweb/xxx. jsp
Before running the JSP Sample Page, pay attention to the JSWDK installation directory, especially the content in the "work" subdirectory. When executing the sample page, you can see how the JSP page is converted into a Java source file and then compiled into a class file (Servlet ).
The sample pages in the JSWDK package are divided into two types: JSP files, HTML files containing a form, which are processed by JSP code. Like ASP, Java code in JSP is executed on the server. Therefore, you cannot view the JSP Source Code by using the "View Source File" menu in the browser. You can only see the result HTML code. The source code of all examples is provided through a separate "examples" page.