Well, it is simple, just specify the servlet-api.jar in the classpath when compiling your code. Package the compiled classes into a WAR file using jar command, then copy it to the webapps directory in Tomcat.

You don't need an IDE for any form of development. You can just code all JSPs and servlets in a text editor (preferably with syntax highlighting, granted), and test in your own (local or not) web container (e.g. Tomcat). You'll just have to redeploy the entire application if you modify the web.xml file or any of the servlets.

While I don't particularly care what developers use to work on projects (IDE or not), I generally insist on a way to build and deploy the app without an IDE; Ant is my tool of choice for that, which also makes it easier to hook the build into Hudson/Jenkins.

"Running a servlet" without an IDE is not a problem. "Running a servlet" without a webapp container, however, is!

Technically, you don't "run" a servlet. A servlet is not a program nor is it a process. It is a container for a method or methods that, when passed an URL request will process it and return the results. That's why you have to have something that at least minimally pretends to be a servlet container (appserver).

There are a number of options to do that. Just do a websearch for "servlet test framework".

An IDE is no substitute for an Intelligent Developer.

Vicky Vijay
Ranch Hand

Joined: Apr 23, 2008
Posts: 125

posted Feb 24, 2012 05:56:39

0

Rob Spoor wrote:Nonsense. You don't need an IDE for any form of development. You can just code all JSPs and servlets in a text editor (preferably with syntax highlighting, granted), and test in your own (local or not) web container (e.g. Tomcat). You'll just have to redeploy the entire application if you modify the web.xml file or any of the servlets.

Rob Spoor, Follow the Forum etiquette while provide your comments !!

Its cumbersome work, handling it using the text editor..

Let say, If your project contains 60 JSP files, 30 Servlet files handling 10 different modules.... in this case, it would be better if you work with an IDE

It's not mandatory that you should use IDE, It makes the developer effort minimal and increase the productivity.

If you're talking about BeNice, I apologize. I never meant to belittle you, or not be nice to you. I misread your post; I thought you said an IDE was necessary. That was what I was calling nonsense, not the fact that an IDE makes life easier for you (which it certainly can do).

Guru Vijay wrote: It's not mandatory that you should use IDE, It makes the developer effort minimal and increase the productivity.

No always true, alas. Like Rob, I also always make my projects capable of being built outside an IDE. For one thing, my production build machines often are non-GUI server systems. For another, I've seen seriously reduced productivity in shops where IDEs were such integral parts of the development system that you couldn't borrow - or fix - anyone else's code unless you first re-created their entire IDE environment. Assuming it didn't conflict with your own IDE environment. Or in some cases, use an entirely different brand of IDE. That's not even considering the horrors which can result when people who don't understand technology let their IDE do their thinking for them.

Offline build systems don't have to carry this liability. Theoretically, neither should IDEs, but I'm talking what is and not what should be. My Maven-based projects can be built not only in the building, but will build equally well in Kamachatka, Karnata, or Senegal and they don't need a specific OS or IDE to do so.

Rob wasn't saying "Nonsense" to be impolite, he was saying that it literally does not make sense to get tied up that closely with the Tool of the Day.

In any event, abhinav is asking specifically how to do a non-IDE test. So that's what we're trying to help.

No always true, alas. Like Rob, I also always make my projects capable of being built outside an IDE. For one thing, my production build machines often are non-GUI server systems.

I strongly agree with that. I think in general, we should be flexible for any circumstances may happen. It's trivial to use an IDE in the workplace, however it's quite different on the customer's site where the server is installed with only Tomcat/JBoss or some else servers, and access to the server is very strict (connect only through terminal), so developers need to have ability to troubleshoot/solve problems without using IDE.