Configuring Tomcat on Eclipse

Source: Internet
Author: User

Configuration and simple examples of Tomcat in eclipse

The configuration of Tomcat in Eclipse is a very simple job, as a novice programmer, I write down the process of this configuration and the simple example, and I want to give some help to the novice like me.

First, the tool download

Eclipse, the latest version of Eclipse is the Mars release. For:
http://www.eclipse.org/downloads/
Tomcat, the latest version is 9.0. For:
https://tomcat.apache.org/
I am using the Eclipse Luna version, and Tomcat is version 8.0.

Second, Tomcat

Tomcat is a green no-install software that extracts the downloaded Tomcat directly to a certain path. I unzipped the path to D:\tomcat8.0\apache-tomcat-8.0.14.

Startup.bat to start the Tomcat service, a black window will appear after double-clicking

Test Tomcat. Open your browser and enter it in the address bar
http://localhost:8080
Enter, if you see a JSP page from Tomcat, this indicates that Tomcat started successfully.

Iii. configuration of Tomcat in eclipse

Configuring Tomcat in Eclipse makes it easier to develop Web projects. Open Eclipse, select Window/preference/server/runtime environments, select Add on the right

Select the corresponding Tomcat version, I am using Tomcat8.0, so the choice is Tomcat8.0.

Select Next and select the path to Tomcat.

When you click Done, the Tomcat8.0 will appear in the preference.

At this point, Tomcat is configured in Eclipse.

Iv. A simple example of Tomcat in eclipse

Select File/new/dynamic Web Project to create a new Web project called Tomcattest.

Select Next

In the third step, Shang options.

After the creation of the Tomcattest, a new JSP file is created within the webcontent of the project.

Add HelloWorld to the JSP file.

<%@ page language="Java" contenttype="Text/html; Charset=iso-8859-1 "pageencoding="Iso-8859-1"%><! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" "HTTP://WWW.W3.ORG/TR/HTML4/LOOSE.DTD" ><html>< head><meta http-equiv= "Content-type"  Content=<title>insert title Here</title></head ><body>helloworld</body></HTML>     

Next run the JSP file, right-Newfile.jsp/run as/run on Server

Select the tomcat that already exists in localhost and click Finish,tomcat to start

You'll see the results of the run in the browser that comes with eclipse: HelloWorld.

Configuring Tomcat on Eclipse

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.