Js|server JavaServer page (JSP) is a java-based technology for generating dynamic Web pages that support Cross-platform, cross Web servers.
The JSP can be compared to Microsoft's active Server page, but it uses HTML-like markup and Java code Snippets instead of VBScript. If you use a Web server that does not natively support ASP (that is, Apache or Netscape servers), you can consider JSP. You can also purchase ASP plug-in modules for these servers, but it is expensive. Also, Sun does not charge a license fee for JSP (although it may be collected in the future). These components of Solaris, Linux, and Windows are also easily available.
Do not confuse JSP with server-side JavaScript. The Web server can automatically convert Java code snippets generated by JSP into a Java Servlet. JSP can also automate many of the features previously written with Perl scripts or server-specific APIs, such as ASP.
Now we'll get you started and help you create one you need a Java 2 Software Development Kit (JSDK), which formerly known as Java Development Kit (JDK), you also need JavaServer Web Development Kit (JSWDK), Tomcat, or other JSP-enabled Web servers. Sun provides free JSDK and JSWDK for operating systems such as Windows, Solaris, and Linux.
If you want to use JSP on your existing Web server, and the Web server itself does not support JSP and the Java servlet, try Allaire's jrun, which can serve as Netscape's enterprise and FastTrack server, Plug-ins for Microsoft's Internet Information Server (IIS) and personal Web Server (PWS), Apache, and some other servers. You can also use the Java version of the Apache Web server, which is included in the latest JSWDK.
Download and install the software
Currently, the 1.2.2-001 version of JSDK is an archive that can be downloaded and installed. This approximately 20MB download software provides a complete Java development environment that allows you to create any java-based solution that uses the standard core APIs. However, the only thing your Web server needs to do when using JSP is to access the Java compiler. To tell the location of the Web server compiler, you need to set the environment variable java_home to the installation directory that points to JSDK. If you have installed and selected the default directory on Windows, you should add a "set java_home=c:\1.2.2" line to the Autoexec.bat file, and then restart your computer.
After installing JSDK, download and install Tomcat on the JSWDK or java-based Apache Web server--beta version. You can put it anywhere, as long as you can find it again. In general, it is placed at the highest level of the directory so that you can replace the JSWDK or JSDK version without having to move the other one. After you install this file, you will be able to develop JSP.
After the JSWDK is properly installed, run the StartServer command to start the Web server. By default, it listens on port 8080. To check that the installation is correct, you can load a JSP sample file (http://localhost:8080/examples/jsp/) After you start the server. If you can successfully run the sample file, this means that your installation is correct. However, if you display an error message in the console window that is used to start the server, you need to resolve the problem. The most common problem is that Java_home environment variables are not set (or are not set correctly). To view the current environment variable settings, you can enter the "set" command at the DOS command prompt.
Start using
Before interpreting the JSP syntax, create a Web page that displays the current date and time, and save it as a sample.jsp.
<title>first page</title>
<body>
<%= new Java.util.Date ()%>
</H3>
</body>
Put this file and all your HTML and JSP pages into the Web page directory under the JSWDK installation directory. You can load this page in http://localhost:8080/sample.jsp. When this page is first accessed, the Web server translates the JSP into a Java servlet so that you can see the current date and time of the system. Now, after downloading, installing, and configuring the development environment, you can learn the JSP syntax and create your own JSP based solution.
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.