Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
    Bookmark Topic Watch Topic
  • New Topic

running a servlet

 
adwin berkowits
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Report post to moderator
i wanted to ask if this is the proper way to compile and build a servlet in order to launch it via tomcat
becuase there is an additional index.jsp and i dont need it ,( i have a servlet to run)

http://briggs.myweb.port.ac.uk/WEBP/notes/tools/nbservlets.htm

if it is the proper way how can i run the servlet via the tomcat i use the tomcat installed by the netbeans

there is stuff on the internet but there is no documnet that guide for all the details needed to run a servlet
do i have to include the package of the project
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Report post to moderator
Well, as I recently said, you don't "Launch" or "Run" a servlet. A servlet is not a stand-alone application, it's a class in a Web Application that contains methods that are invoked to process HTTP requests and return responses. It does not have an independent process/thread identity (and, in fact the J2EE standard forbids it), and therefore, except when the servlet's request handler method is being called, it's not running at all.

You should in no event be dependent on an IDE such as NetBeans to be able to use J2EE, if for no other reason that in the real world, production webservers do not run in IDEs, they run in stand-alone appservers. An even bigger problem is that you evidently don't understand what a web application truly is or how it's put together since you've been relying on Netbeans to do it for you.

All the details you need on how to create a web application and use servlets in web applications are written down in detail in numerous books and tutorials both in local bookstores and on the Internet. Some of these books are 10 years old now, and still fundamentally useful, others are more up-to-date.

The key is to stop thinking of servlets as "something Netbeans 'runs'" and start thinking of them as what they really are: components of web applications.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18020
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Report post to moderator
Also, this appears to be basically a continuation of a thread that you started in the IDE forum, so let's keep the conversation there. Running the same question in more than one forum causes a lost of confusion and wasted effort. http://www.coderanch.com/t/568315/vc/running-servlet
 
    Bookmark Topic Watch Topic
  • New Topic