This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Sure. If all you need is a small number of pages and a few beans, then JSP on its own is great. Likewise, if you don't need fancy HTML generation (or just don't like JSP) then you can build a perfectly reasonable web application only using servlets.
Everything that can be done in JSPs can be done in servlets and vice versa. However, it can be extremely awkward to use one (such as the example Frank gave with a lot of presentation details.) It can be done with servlets, but it shouldn't.
Hi Frank & Jeanne... Even I was unable to guess any situation like this...also thought in the same way as Frank..If no GUI's has to be made, servlet is the best option, only if we need some sort of HTML stuff to be shown to the users, we would use JSP. But can anyone guess some specific situation TIA MB
Since JSP are designed to output a character stream it is essentially impossible to use JSP to serve binary data such as images. If your application needs to generate images or sounds on the fly, you are going to end up using servlets. Bill
author & internet detective
While it is possible to do almost anything (including generating binary data) with servlets, it is not always a good idea. You could stick whatever code would be in the servlet inside a JSP scriplet. However, this is poor style and should be avoided. But it can be done.