Eclipse+tomcat Development Web Program __web

Source: Internet
Author: User

Environment: Windows 7+eclipse Java EE IDE for Web Developers+tomcat 7.02

Plugins: Tomcatpluginv321.zip A. Configure the Tomcat plug-in

We create a Myplugins folder to store the plugin, Myplugins is located in the D:/program files/j2ee directory. The Eclipse installation path is: D:/program Files/j2ee/eclipse-javaee. The installation path for Tomcat is: D:/program files/j2ee/apache-tomcat-7.0.2. So Myplugins, Eclipse-javaee, and Tomcat are in the same directory, and of course this is not necessary. Just easy to manage.

Then create the directory where the user holds the Tomcat plug-in: D:/program Files/j2ee/myplugins/tomcatpluginv321/eclipse/plugins, The com.sysdeo.eclipse.tomcat_3.2.1 in the Tomcatpluginv321.zip is then decompressed to the D:/program files/j2ee/myplugins/tomcatpluginv321/ The Eclipse/plugins directory. Eclipse/plugins here is a must.

We create a links folder under Eclipse-javaee, and then create a Tomcat.link file under the Links folder. You can create a text file and save it as a tomcat.link by first. Use Notepad to open Tomcat.link, enter: Path=d://program files//j2ee//myplugins//tomcatpluginv321.

At this point Tomcat's external configuration is complete, and then the eclipse is turned on, and we will find that there are small tomcat icons in eclipse.

Then "window"-> "preferences" in Eclipse to open the interface shown in the following figure

In Tomcat's Advanced tab, enter the address of Tomcat base, which is the installation address of Tomcat

At this point we can start Tomcat by using the Tomcat small icon in the Eclipse menu bar. two. Configure Eclipse's server

Like configuring Tomcat, it is also configured under "Window"-> "preferences" in Eclipse, as shown in the following illustration:

Only Tomcat is configured to publish the Web site through Tomcat. The previously configured Tomcat plugin only allows us to match the quick start Tomcat in Eclipse, and the publishing site is configured in this step. As shown in the figure above, we have two Tomcat servers configured here, TOMCA 6.0 and Tomcat 7.0, which we can use to determine which server is to be used. This configuration server is also very simple, only need to add a bit on it. As shown in the following illustration:

After configuring the server, we will use them later. three. Creating Web Applications

Next we'll create a Web project, as shown in the following figure

This creates a dynamic Web application. From the above we can see that there is a target runtime option, which is the server we created earlier, where we chose Tomcat 6.0 and Eclipse will automatically select the dynamic web for us after we select Target runtime Module version and configuration These two options, we can by default, click Finish to complete the creation of the project. Create a index.jsp file in the WebContent directory of the TESTTOMCAT2 project that you created. As shown in the following illustration:

four. Publish Web Apps

Right-click the project TESTTOMCAT2, select Run as-> run on server, as shown in the following illustration:

Click Finish to complete the release, and the published project will be automatically opened in Eclipse after release, as shown in the following illustration:

This is the entire process of publishing Web applications through Eclipse and Tomcat.

PS: Attention Point

Using Plug-ins in eclipse to configure Tomcat and using Server configuration tomcat is a two different concept, and if you want to publish a Web application you must use the server, and you can use Plug-ins to start Tomcat. But it feels like server configuration Tomcat does not need to use plug-ins.

A problem was found today when debugging was to start Tomcat with a plugin and then open it in the browser: http://localhost:8080 can open Tomcat's home page, but if you use server to start Tomcat, The homepage is not open in the browser, but it can be opened if a project is posted in tomcat. For example, you can open: Http://localhost:8080/demo the index.jsp file under this project. The reason feeling is the server.xml disposition question, but the concrete I also cannot say clearly.

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.