JS JSP (Java Server pages) is based on Java technology and in traditional Web page HTML files (?. Htm?. HTML) By adding Java code Snippets (scriptlet) and JSP tags (tag) to form a JSP Web page (?. JSP). When a Web server encounters a request to access a JSP Web page, it first executes the program fragment in it, and then returns the execution results to the customer in HTML format. All program operations are performed on the server side, and only the resulting results are delivered to the client on the network.
JSP technology is completely platform-independent design, including its dynamic web pages and the bottom of the server element design. Because of this, you can debug the program in the Windows environment, successfully upload the program to your Linux server to run, in addition, because it is compiled and executed, so the execution speed is much faster than the previous server-side language.
There are many ways to configure JSP, if you already have a Web server that you can use, such as Netscape's Enterprise server and FastTrack server, and Microsoft's Internet Information Server (IIS) and personal Web Server (PWS) and Apache, the more typical approach is to use Jrun (http://www.allaire.com/products/Jrun/), It can be added as an attachment to your Web server. If you are using Apache, you can also choose the Java version of the Apache server, which contains the latest JSWDK.
This article introduces a common JSP configuration method, whether you are on a Windows or Linux platform, or whether you originally installed the Web Server, this method is universal.
For Solaris (available for Linux)
Jswdk1_0_1-solsparc.tar.z
953434 bytes
In the above page, you need to answer some simple questions, you can get Windows and Linux two versions of JSDK and JSWDK, a total of four files.
Step Two: Install JSDK
The JSDK installation methods under Windows and Linux are as follows:
1.Windows installation, double-click Jdk-1.2.2_005-win.exe and select an installation directory.
2.Linux install, become root user, select a directory, perform tar zxvf/path/jdk1_2_2-linux-i386.tar.gz.
The installation directory above must be accurately documented and used in subsequent configurations.
Step Three: Install JSWDK
1.Windows installation, you must first have a software that can unlock the zip package, then expand the Jswdk1_0_1-win.zip and save it to a directory of your own.
2.Linux Install, select a directory yourself, perform tar zxvf/path/JSWDK1_0_1-SOLSPARC.TAR.Z.
Step Fourth: Configure environment variables
1.Windows NT, click the right mouse button on my computer, select Properties → environment, and then perform the following three steps:
(1) Add variable classpath, the value is the path to install JDK \lib\tools.jar, for example C:\jdk1.2.2\lib\tools.jar.
(2) Add the Java_home variable, which is the path to install the JDK, such as c:\jdk1.2.2.
(3) Modify the path variable followed by the route \ Bin for installing the JDK, such as C:\jdk1.2.2\bin.
2.Windows 98, run sysedit, add and modify variables ibid.
3.Linux, if you use bash, you can enter directly at the command line:
Java_home= "/home/look/jdk1.2.2"
Classpath= "/home/look/jdk1.2.2/lib/tools.jar"
Export CLASSPATH
Path= "$PATH:/home/look/jdk1.2.2/bin"
To avoid reboot each time, you can put it in the/etc/profile.
Fifth Step: Configure JSWDK
Install JSWDK directory, find Webserver.xml, open it with a text editor, you can modify some of the commonly used configuration, of course, you can also do nothing to change, the default configuration can make the JSWDK run very well.
1.port nmtoken "8080"
This line represents the port number that JSWDK needs to run, and if you don't have another Web server installed, you can change it to 80 or any other legitimate port that does not conflict.
This line represents the directory you mapped to the JSWDK port. Once defined, you can use the "http://localhost: Port/directory" to access the specified file.
Sixth step: Start JSWDK
1.Windows, enter the directory where you install JSWDK, and then run Startserver.bat.
2.Linux, enter the directory where you install JSWDK, and then run./startserver.
Step Seventh: Test
Readers can use http://localhost:8080 or http://your.hostname:8080 to test whether their JSWDK has run correctly. When you see the default page for JSWDK, use the following script to test the JDK's operation.
/? Name test.jsp?/
Import java.io.?;
Import Java.servlet.?;
Import Javax.servlet.?;
public class HelloWorld extends HttpServlet {
public void doget (HttpServletRequest request, httpservletresponse response)
Throws IOException, Servletexception
{
Response.setcontenttype
"Text/html");
PrintWriter out = Response.getwriter ();
Out.println ("〈html〉");
Out.println ("〈body〉");
Out.println ("〈head〉");
Out.println ("〈title〉hello world!〈/title〉");
Out.println ("〈/head〉");
Out.println ("〈body〉");
Out.println ("〈h1〉hello world!〈/h1〉");
Out.println ("〈/body〉");
Out.println ("〈/html〉");
}}
Put this file in the directory under the JSWDK installation directory. You can load this page from http://localhost:8080/sample.jsp. When the page is first accessed, the Web server compiles the JSP into a Java code snippet, and if you see "Hello world!", your JSP environment configuration is successful!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.