J2EE: Installing Tomcat 7 and Using it with Eclipse
Tools:
Youtube: https://www.youtube.com/watch?v=kLgquZ2FiuQ
Quick start:
Youtube: https://www.youtube.com/watch?v=kLgquZ2FiuQ
Quick start:
- Install Java 7. Download for Windows, MacOS, Linux, and Solaris fromhttp://www.oracle.com/technetwork/java/javase/downloads/.
- Download and Unzip Tomcat 7. http://tomcat.apache.org/
- Install and start Eclipse. Download from http://www.eclipse.org/downloads/. Choose "Eclipse IDE for Java EE Developers", download, and unzip.
- Tell Eclipse about Tomcat. Click on Servers tab at bottom. R-click, New, Server, Apache, Tomcat v7.0, navigate to Tomcat 7 installation folder (e.g., C:\apache-tomcat-7.0.34), OK. If you don't see Servers tab, add the tab via Window, Show View, Servers.
- Run Tomcat. Click on Servers tab at bottom. R-click on Tomcat v7.0, choose "Start". Open http://localhost:8080/ in a browser.
- Import and test a sample Web App. Grab test-app.zip, save it, and import it into Eclipse. Use File, Import, General, Existing Projects, Select archive file. Then click Browse and navigate to test-app.zip. Click on Servers tab at bottom. R-click on Tomcat v7.0 Server, choose "Add and Remove Projects". Choose test-app project. Start Tomcat, or restart if already running. Open http://localhost/test-app/ in browser. Note that this app uses the servlet 3.0 @WebServlet annotation to provide the URLs for the various servlets. See the source code for details.
- Create and test a new Web App. File, New, Project, Web, Dynamic Web Project. Make sure that the Target runtime is "Apache Tomcat v7.0". Copy HTML, JSP, and servlet files from the test-app project into this new project. Deploy and test it as above.
Nguồn: CoreServlet
Nhận xét
Đăng nhận xét