Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

question about Eclipse and running on Tomcat

 
Jay Dilla
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do I have to set up the configuration in order to run JSP files on the Tomcat server?
I thought I could just do localhost:8080/folder/file.jsp
but that is not working.
I know you can also run it thru your eclipse by right clicking the JSP file and selecting run on server
how do i set it up to do either, and which is the proper way to publish jsp/html files to the web?
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18156
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once long ago you could do something like that, but it was a major security risk, so it's turned off by default these days. You're better off setting up a formal web application in WAR format. A simple way to deploy a WAR is to drop a copy of the WAR file in the TOMCAT_HOME/webapps directory. In the Tomcat 5.0 releases (should include more recent Tomcats, too), the WAR file will be unpacked into a directory having the same name as the basename of the WAR file. Assuming there's not already one there, in which case you should first delete the old webapp directory.

Simple does not equal recommended - for "proper" ways to deploy webapps in Tomcat, I recommend you study the Tomcat docs. But the simple way will get you going until you learn better ways.

Regarding your question of how to publish JSPs and HTML pages, the answer is that you build a WAR file containing the JSPs, HTML, CSS, images, Java code and whatever other resources the webapp will need, then deploy the WAR to your Tomcat (or other webapp) server. a WAR (or Web ARchive) is a ZIP file with a specifically-designed structure. Full details are too lengthy to go into here - get a good book on Java web application development.

The "Run on server" option is a rather specialized feature involving remote application deployment. I've never used it. Eclipse does not come with a builtin webapp server - neither Tomcat nor any other webapp server. Instead you have to install a webapp support plugin into Eclipse. I use the sysdeo Tomcat plugin, which allows Eclipse to start up a copy of an externally-installed Tomcat and debug applications running in that copy of Tomcat. There are several other plugins that can do similar things.
 
Sunil Vasudevan
Ranch Hand
Posts: 107
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need Web Tools platform plugins with Eclipse to do a right click and run Servlets/JSPs etc on server.

Check this website: http://www.eclipse.org/webtools/main.php
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic