Monday, February 17, 2014

Things you should know using eclipse and Tomcat


  1. You should stop Tomcat service when you want to test your jsp within eclipse as you will run Tomcat within eclipse.
  2. Eclipse doesn't always display everything. It should copy all files from the project folder to a Tomcat work directory, but it doesn't! It tends to “lose” CSS files and images. This means that, except for a quick check of simple features, you might do what I do and use Tomcat externally. To see the output of the test project outside Eclipse, first of all, stop the “internal” Tomcat by rightclicking it under the Servers tab of the Workbench and selecting Stop. Then, start the Tomcat service in Windows. Right-click the test-project folder as you did to launch it within Eclipse, but this time select Export WAR File. When the WAR Export screen appears, the only thing you have to do is browse to select the destination, which should be %CATALINA_HOME%\webapps\test.war, and click Finish. In a browser, type http://localhost:8080/test to see the output of the project. This works because, as I showed to you at the end of the previous section, Tomcat automatically expands all WAR files it discovers in its webapps folder, without any need to restart it. And because by default Tomcat looks for index.html, index.htm, and index.jsp. If you want, you can change the default by adding the following element to the body of the web-app element of web.xml: <welcome-file-list>
                           <welcome-file>whatever.jsp</welcome-file>
                  </welcome-file-list>
  3. You can export WAR file to Tomcat folder, you also can import WAR file to eclipse workplace.

No comments:

Post a Comment