- A basic/beginners Eclipse tutorial/overview
- Configuring & Using Apache Tomcat: A Tutorial on Installing, Configuring, and Using Tomcat for Servlet and JSP Development. This will link to step by step instruction like:
- WTP Tutorials – Building and Running a Web Application
- Tips for using Eclipse effectively
- Tips and Tricks (Official site)
- Java Web Programming with Eclipse
- Deploying/Creating Web Apps with Eclipse (pag. 27)
-
Deploy project
– Select “Servers” tab at bottom
– R-click on Tomcat
– Choose “Add and Remove”
– Choose project
– Press “Add”
– Click “Finish” -
Start Server
– R-click Tomcat at bottom
– Start (use “Restart” if Tomcat already running) -
Test URL
– In a Web Browser (something like: http://localhost/your-app/">http://localhost/your-app/)
-
Deploy project
Eclispe plugins
- ResourceBundle Editor: get it on https://github.com/essiembre/eclipse-rbe
Javadoc
- Adding JDK Javadoc in eclipse.
When you are coding in Eclipse, press CTRL and click on any core Java class name in your source. Eclipse will now show a screen saying you don't have the sources installed. However, in this screen there is a link saying "Attach source...". Click that link and import the src.zip file from your JDK installation directory (src.zip).
Sample location: C:\Program Files\Java\jdk1.6.0_37\src.zip - Adding log4j Javadoc
Like mentioned above, click the "Attach source..." button -> "Add external folder" -> browse to the log4j folder on your system and choose the "\src\main\java\" folder inside it.
Sample location: C:\apache-log4j-1.2.17\src\main\java
Preferred way: in eclipse you can define a "user defined library" that defines the jar to import and its source so that you get the Javadoc in Eclipse. Using a library you can re-use it in other projects without needing to define all this stuff for each project.
Web project structure in Eclipse:
- WebContent.: Regular Web files (HTML, JavaScript, CSS, JSP, images, etc.)
- WebContent/some-subdirectory: Web files in subdirectory.
- WebContent/WEB-INF: web.xml (used for servlet mappings)
- WebContent/WEB-INF/lib: JAR files specific to application.
- src/(default package): Unpackaged (default package) Java code. Using the default package is generally a bad choice in Web apps.
- src/somePackage: Java code in somePackage package.
Code templates
Theres a lot of code templates pre-defined in eclipse.To use them you type a keyword and then press CTRL+SPACE:
Ex.: type main and then press CTRL+SPACE to generate a main method.
You can check existing or add your own templates in:
Window->Preferences->Java -> Editor -> Templates
See some tips to create templates here.
Some examples of keywords:
- main: generates a main method;
- try (only works inside a method): generates a try catch;
name | pattern |
---|---|
out | System.out.println("${cursor}"); |
todo | todo |
Sem comentários:
Enviar um comentário