Several basic issues in using Eclipse to build a javaweb development environment

Source: Internet
Author: User
Tags java web

Eclipse Builds Javaweb development environment

Eclipse is an IDE software for Java program Development, and Tomcat is a server software that runs Javaweb applications, and when you use eclipse to develop javaweb applications, it's important to integrate Tomcat into Eclipse, And make a few simple settings for eclipse.

1. Install JDK, install Eclipse, install Tomcat, etc.

================================

Omitted.

2. Eclipse Basic Settings

================

2.1 Set Eclipse's default character set to Utf-9

--------------------------------------------------

In Eclipse, the current operating system's character set will be used by default, and under Windows it will generally be GBK, whereas when developing a Web application, Utf-8 is generally used, so the default character set is required.

In Eclipse, click on the menu bar window->preferences, click General/workspace:

2.2 JDK Settings

--------------------

The Eclipse runtime requires a JDK to build a Java project or Java Web Project in a jre,eclipse, and it can be set up in Eclipse's preference page.

2.3 Tomcat integration into eclipse

---------------------------------

When you build dynamic Web project in Eclipse, you need to choose a target runtime, which is the runtime environment for the Javaweb project, the one where the WEB project will run in the future, so before you build the project, You need to build a runtime environment for a Web project.

3. Basic configuration after the integration of Tomcat in eclipse

=============================

The Eclipse project was published under Tomcat, why WebApps? Because the default is in Workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps

Unlike MyEclipse, Eclipse does not deploy projects to WebApps in the Tomcat installation directory by default, but is deployed by default to the working directory. METADATA\.PLUGINS\ORG.ECLIPSE.WST.SERVER.CORE\TMP1 \wtpwebapps, the Tmp1 folder contains information about the item.

In order for the project to be deployed by default to WebApps in the Tomcat installation directory, show view->servers-> find the tomcat-> that needs to be modified right-click ① Stop the Tomcat server (stop) ② Delete the project deployed in the container ( Remove) ③ clear the container related data (clean) ④ Open Tomcat's Modify interface (open) ⑤ Find servers location, select second (User tomcat installation) ⑥ Modify Deploy Path is saved off for Webapps⑦ under Tomcat.

(8) Under Server options, select "Publish module contexts to separate XML files".

(9) Under Publishing, select Automatically publish when Resources Chagne

When you deploy the Web app to Tomcat later, as long as you select the project in Project Explorer and then right-->run->run on server, The Web project is published to the WebApps directory under the locally installed Tomcat.

If the above step 8 is also done, the context element will be in Tomcat_home/conf/catalina/localhost/web-app-name.xml.

If this is done in step 9 above, the Web project published in Tomcat will take effect immediately after it has been modified. This is handy for debugging Web projects, because once a little change is made, Tomcat immediately publishes the result of the modification, so we can see the effect of the modification immediately.

4. Publish the Web project into Tomcat in eclipse

-------------------------------------------------------

When you publish a web app to Tomcat, you should normally leave Tomcat in the stop state, and after it's published, startup Tomcat,tomcat will automatically read to the Web app it's published to.

In Project Explorer view or Navigator view, select the Web project you want to publish, right-->run->run on Server,web-app appears under Tomcat in Servers view, and then TOMCA automatically starts, and the first page of the Web-app that you publish to will automatically appear in the Internet Web browser view.

The Internet Web browser view is a Web browser provided by Eclipse for debugging Java Web projects. In Preference General->web browser, you can set the Web browser that eclipse opens by default.

Resources:

1, the Web development Environment Construction Eclipse-java EE Chapter, 77461006

2. The Eclipse project was released to Tomcat, why WebApps? , 51470816

Several basic issues in using Eclipse to build a javaweb development environment

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.