http://blog.csdn.net/wozaifeiyang0/article/details/6888197#_Toc281559669
1. Construction of the development environment ...-1-
1.1. Development tools ...-1-
1.2. Build the development environment ...-1-
2. Developing Web Projects ...-1-
2.1. Create a new Web project ...-1-
2.2. Development Servlet-3-
2.3. Publish Web Project ...-5-
2.4. Develop JSPs. -7-
1. Construction of the development environment 1.1. Development tools
Jdk:jdk1.6.0_17
Web server:apache-tomcat-6.0.26
Ide:eclipse-jee-helios-sr1
1.2. Build the development environment
By selecting the IDE as a development tool, the IDE can manually configure the required plug-in tools, so it's easy and quick to build a development environment.
(1) Installing the JDK
Tip: You need to configure environment variables after you install the JDK.
(2) Installing Tomcat
Tip: If the decompression version is directly decompressed OK, if the installation version needs to follow the installation instructions to complete the installation. Because you are using the IDE for development, you do not need to configure the Tomcat environment variables, but it is recommended that you do not rely too much on the IDE.
(3) Unzip eclipse
Tip: If you do not have a JDK installed, you cannot complete the installation of Eclipse.
Okay, here's the development environment ready, then use a demo to demonstrate how to develop Web projects in eclipse.
2. Developing Web Project 2.1. Create a new Web project
Eclips-->file-->new-->dynamic Web Project
Select New Runtime under Targetruntime to configure the Web Server
Next>
Select the Tomcat installation directory via browse
Tip: Note that the JRE version of Tomcat is consistent with the JRE version of Project
Finish>
After that, all the way next until finish is OK.
The new Web project structure is as follows
2.2. Developing Servlets
Right-click on src on Projectexplorer view to select New-->servlet
Next>
Choose to override the service method, which automatically generates code to make it easier
Of course, you can write the servlet all manually, but don't forget to configure the servlet in Web. XML, hehe ^_^
Then finish completes the creation of the servlet.
Hello.java source code is as follows
Package Org.wenlong; Import java.io.IOException; Import javax.servlet.ServletException; Import Javax.servlet.http.HttpServlet; Import Javax.servlet.http.HttpServletRequest; Import Javax.servlet.http.HttpServletResponse; public class Hello extends HttpServlet { protected void Service (HttpServletRequest request, HttpServletResponse response) throws Servletexception, IOException { System.out.println ("Hello Servlet"); } } |
|