Java servlet is a Java code running on the web server, which can accept user requests, perform corresponding processing, and provide feedback to users. Its role is similar to the CGI program, which can realize a lot of interactive effects in the web page, but higher efficiency than CGI program. 1. Software download
Development software has two: JDK1.x and jswdk1.x.x.
To http://java.sun.com, downloaded JDK may also be the J2SDK1.4.1_07 file installed on your computer.
Jswdk1.0.1 can be downloaded from http://java.sun.com/products/jsp/download.html. Download the jwwwdk1_0_1-win.zip to decompress a directory with WinZip software, such as: D: /, will automatically create a subdirectory: JSWDK-1.0.1. At this time, JSWDK 1.0.1 is already installed in the D: /JSwDK-1.0.1 directory.
2. Start JSWDK 1.0.1
Set good environment variables:
Set classpath = c: jdk1.x / bin ;.
SET PATH = C: JDK1.x / bin; (may not be the same, this depends on you to install the program to the directory)
Then use the CD command in the DOS window to enter the JSWDK 1.0.1 installation directory (such as D: /JSwDK-1.0.1) running StartServer.bat.
After running, a string is displayed, and finally shows EndPoint Created: localhost / 127.0.0.1: 8080. It indicates that normal startup is started. But it does not support queries of database Chinese fields and Chinese values.
Open a browser, type: http: // Your machine IP address: 8080, then the default page is displayed in this page, and you can view the servlet example in this page. Enter the command in the previous DOS window:
Set path = c: jdk1.x / bin; set classpath = c: jdk1.x / bin; d: /jswdk-1.0.1/lib/servet.jar
To set a good environment variable.
Javac xx.java compiles Java programs
Copy * .class d: /jswdk-1.0.1/examples/web-inf/servlets
Copy the compiled program to the Java Servlet Run Directory.
* If you use the old version of JDK1.2, in order to run the Java Servlet program, you also need to modify a file:
D: /jswdk-1.0.1/examples/web-inf/servlets.properties
Use the text editor to open the file, in the last plus a few lines:
xx.code = xx
Xx.initparams = foo
Enter http: // machine's IP address: 8080 / examples / servlet / xx, you will experience the effect of servlet.