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.
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