Eclipse integrated Tomcat (tomcatforeclipse) development in Linux

Source: Internet
Author: User
Tomcatforeclipsehttp: // www.eclipsetotale.com is not talented and has a limited level. He translated the plug-in features, Installation Guide, and hello examples of tomcatforeclipse on some websites. Please correct me more.
  • Plug-in features:
1. start and Stop atat4.x, 5.x, 6.x, 7. x2.eclipse debugger registers Tomcat process 3. create a war project (the wizard can update the server. XML file) 4. add a Java project to Tomcat classpath5. set Tomcat JVM parameters, classpath, and bootclasspath6. export a tomcat project as a war file 7. capability to use a custom Tomcat classloader to load classes in several Java projects at the same classloader level than classes in a tomcat project, see readmedevloader.html (not studied yet)

  • Download tomcatforeclipse
Web: http://www.eclipsetotale.com/tomcatPlugin.html#A3
Http://www.eclipsetotale.com/tomcatPlugin.html#A4
  • Install
1. this plug-in does not contain Tomcat (download and install Tomcat before using this plug-in ). tomcat is not included in the release version of this plug-in. This is a design choice. In this way, plug-ins of the same version can be used with any version of Tomcat.
2.download tomcatpluginvxxx.zip 3. decompress the package as follows:-eclipse_home/dropins for eclipse 3.4, 3.5 and 3.6-eclipse_home/plugins for eclipse 2.1, 3.0, 3.1, 3.2 and 3.3 put the decompressed folder under dropins or Plugins in the main directory of eclipse installed by yourself (by version)

4. For eclipse 3.x plug-in activation mode:-use the-clean option to start eclipse-if the Tomcat flag is not displayed on the toolbar: Select 'window> mimize
Perspective...> commands, and check whether 'tomcat 'is in 'availabe command groupup'.

5. set the main directory of Tomcat and tomcat: workbench-> preferences, select Tomcat and set the tomcat version and main directory (tomcat version and main directory of Tomcat are required, other settings are for more advanced configurations)



6. This plug-in starts Tomcat with the default JRE on the eclipse parameter interface. You can open the eclipse parameter interface and set a JDK seat default JRE: window.
-> Preferences-> JAVA-> installed jres. This JRE must be a JDK (a prerequisite for Tomcat ).

7. This plug-in sets the classpath and bootclasspath of Tomcat. You can set specific parameters using preferences-> tomcat-> JVM settings.


  • Tomcat Tutorial: helloworld

Http://keyboardsamurais.de/2004/01/15/tomcat_tutorial_helloworld_for_complete_fools_-_english/

Here I download the latest version: 3.3 atatpluginv33.zip my tomcat 6.0

 

For this tutorial, the following three software must be installed:

Tomcat

Eclipse 3.x

Tomcatforeclipse

Plugin:

1. When you install tomcatforeclipse, you will notice that these buttons and menus are in your own IDE.

Start Tomcat with the left button, stop Tomcat with the middle key, and restart Tomcat with the right key.

2. go to window-> preferences configuration and check the following dialog box:

Select Tomcat from the menu, and select your tomcat version. Here is 6.0, and then select Tomcat home. The plug-in now knows where to find the server. XML, and the standard path of the file can be automatically estimated. Eclipse can now manage this configuration file.

3. Here you can add a management user, you can also go to the conf/tomcat-users.xml to add users

4. Now we can prepare for the test. Open the server and click the OPEN button on the Tomcat menu. You can see the output on the console. After Tomcat is started, open the browser and enter http: // localhost: 8080/. If you see the following figure, it will be OK.

5. Hello World

Now, we stopped the Tomcat service and wrote our first servlet.

First, we need to create a project under nagigator.

6. Select Tomcat Project

7. enter a new project name and click Next.

8. Click the next button. Now we can adjust the URI (unified resource identifier). We want our new application to respond to our requests. To describe part of the URL, just take a look at the following address: http: // localhost: 8080/Helloo/Hello.

9. The default configuration for other controls is OK, so we will not adjust it. So ultimately

10. After clicking finish, we can see that eclipse has created a project

11. Now we create a new class named helloservlet under the directory WEB-INF/src

The Code is as follows:

 

import

Java. Io .*;

 
 
import

Javax. servlet. http .*;

import

Javax. servlet .*;

 
 
public

Class helloservlet extends httpservlet {

  public void doGet (HttpServletRequest req,
                                         HttpServletResponse res)
        throws ServletException, IOException
  {
        PrintWriter out = res.getWriter();
        out.println("Hello, Brave new World!");
        out.close();
  }
}
 
 
The image is as follows:
 
 
 
 

 

12. Sorry, it's not over yet. We also need to create a web. xml file, which we create under the WEB-INF

Web. XML is as follows:

13. Start the server and enter http: // localhost: 8080/helloo/hello in the browser.

Congratulations! You have already taken the first step in Web programming in Linux.

As shown in:

14. Create an index. jsp file under the helloo project. The Code is as follows:

 

Enter in the browser:

Http: // localhost: 8080/helloo

Http://zhangzhaoaaa.iteye.com/blog/1670727

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.