Js|servlet| compilers believe that many friends who just started learning about servlet and JSP have a problem with how to quickly and easily build a servlet and JSP running, debugging, and compiling environment. I am currently studying abroad at MIT (Master of Information Technology), and the subject now selected is Wbis (Web Based information Systems), which includes many technologies, such as Java,perl, Cgi,servlet,asp,java script,jsp,oo,uml and so on. The following article is the download address, installation method and instructions for the relevant software provided by the school, and the required software (which the school has provided us with a CD) has been installed and tested. Here, I highly recommend to everyone, because the whole installation process is very simple, as long as the following article in the method of step-by-step, 100% can be successful, I believe will bring you help. Although the article is all in English, but very simple, I believe that we can understand. If there is any problem, I hope you can come forward and discuss it with us.
(Note: The four software mentioned in this article are JDK 1.3.1,bluej 1.2.0,apache Tomcat 4.0 and Bluej_tomcat_config.zip respectively.) Where BlueJ is used to create and compile the servlet, and the last zip file is configured with BlueJ and Tomcat. )
BlueJ, Jakarta Tomcat and Java 2 SDK installation
1. Install the Java 2 Software Development Kit (JDK)
It is recommended the install JDK 1.3.1, which can be downloaded from here (http://www.csu.edu.au/faculty/sciagr/sis/s Ubjects/itc357/j2sdk-1_3_1-win.exe), or from http://java.sun.com (unfortunately it's a 30M download so if you have a slow Modem it may is better to acquire it on CD. For example, there are a CD containing JDK with many Java text books).
Install JDK to the default directory, which is c:jdk1.3.1
You could use a different version of JDK (1.2 or later) but you'll need to change the Tomcat configuration files startup.b At and Shutdown.bat to the directory location.
2. Install BlueJ (BlueJ is a basic Java editing and compilation environment This sits on the top of JDK)
It is recommended so you install BlueJ 1.2.0, which can are downloaded from here (http://www.csu.edu.au/faculty/sciagr/sis /subjects/itc357/bluejsetup-120.exe) or from http://bluej.org
Install BlueJ to the default directory C:bluej
If You are install a different version of BlueJ or place it different directory the configuration files provided in BlueJ _tomcat_config.zip won't automatically go in the correct directories and you'll have to manually extract each one.
3. Install Apache Tomcat (Tomcat is a Java Web application server and would allow to test your servlets and JSP files L ocally)
It is recommended so you install Apache Tomcat 4.0, which can being downloaded from here (Http://www.csu.edu.au/faculty/scia Gr/sis/subjects/itc357/jakarta-tomcat-4.0.4.exe) or from http://jakarta.apache.org/
Install Tomcat to the default directory C:Program Filesapache Tomcat 4.0
If You are install a different version of Tomcat or place it different directory, you'll need to configure it manually As the configuration files provided in Bluej_tomcat_config.zip won't automatically go into the correct directories and Various paths settings contained in them won't be correct.
4. Configure BlueJ and Tomcat to work together
The recommended way to be to download the file Bluej_tomcat_config.zip (http://www.csu.edu.au/faculty/sciagr/sis/s Ubjects/itc357/bluej_tomcat_config.zip) and extract the files to the root of drive C:, making sure that you choo SE the option to use folder names.
If you are need to manually configure BlueJ or TOMCAT, you are need to troubleshoot problems or your want to examine the Configurat Ion options chosen, they are explained here.
Compiling and Running servlets on Your local Machine
1. Run BlueJ and open the existing project in the C:Program filesapache Tomcat 4.0webapps estingweb-infclasses Directory
2. Create a new class and enter the code for your servlet, or with Edit-add class from file to import a existing servlet s Ource file.
3. Compile the servlet.
4. Start tomcat by double-clicking on Startup.bat in the C:Program filesapache Tomcat 4.0in directory. This'll start Tomcat listening on the port 8080 on your local machine (you don ' t need to be online).
5. Start up your Web browser and open the URL http://localhost:8080/testing/servlet/Servletname where Servletname is the n Ame of the Your servlet.
File locations and relative references within local and remote Servlets
HTML files located in a directory like C:Program Filesapache Tomcat 4.0webapps esting'll be accessible through a URL lik E http://localhost:8080/testing/filename.html
Similarly if you are HTML file in your home directory on the SWAP server it'll be assessible through a URL like htt P://swap.csu.edu.au:8080/username/filename.html
If you are need to place a page generated by a servlet, can be place it in C:Program Filesapache Tomcat 4.0webapp S esting (or on the "swap server in your home directory") and refer to it in the HTML as. /imagename.jpg (eg. )
If you are need to link to another servlet or specify another servlet within the "a" form, you can simply us E The servlets name. For example your could use the code <a href= "Otherservlet" > To link to another servlet assuming and you have A file In the testingweb-infclasses directory called Otherservlet.class (or in your web-infclasses directory on the SWAP server)
If you have a static HTML page which has a link to a servlet or a form with a ACTION attribute that refers to a servlet, a nd the HTML page is located in the C:Program filesapache Tomcat 4.0webapps esting directory or in your home directory on t He SWAP server, with the URL Servlet/servletname to refer to the servlet (eg. action= "Servlet/servletname").
It is recommended ' use ' relative references like this in your HREF, SRC and ACTION attributes so and can Easi Ly move your pages from the local machine to the server.
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.