A servlet is a normal java class file where you can request the data posted to the servlet. Here you just write java code like in ordinary classes, but to write the html code is a bit slow, because you have to make an out.println("<html><body>Hello servlet</body><html>"); to print out your graphic.
In the servlet you can also use the init(), service(), destroy()...
[ July 30, 2005: Message edited by: Jeppe Fjord ]
You usually split up your application into two portions:
The business logic (content generation), which governs the relationship between input, processing, and output
The presentation logic (content presentation, or graphic design rules), which determines how information is presented to the user
Using this rationale, you may choose to have business logic handled by Java beans, the presentation logic handled by JavaServer Pages (JSP) or HTML files, and the HTTP protocol handled by a servlet.
If your are working on bigger apps then you will soon see the benefits of doing the above, but on a very small and simpe application maybe you won�t see it.
[ July 31, 2005: Message edited by: Jeppe Fjord ]
Originally posted by Arathi Raj:
Can any one tell me, when is necessity for using jsp in developing website. and when to use servlet. and when to use both jsp and servlet. what are the uses of using both JSP and servlet.
And when to use jsp, servlet and ejb all 3. Can any body explain me clearly with example.