jsp & Servlet

i hered that servlet is prefered to jsp.Is it so?If Yes Then....What is the thing that is there in Servlet and not in JSP?
[150 byte] By [Vivek@Bhartia] at [2007-11-26 16:46:34]
# 1

Servlet and JSP have same capabilities. They can be used interchangeably. But the servlets are used for request processing, implementing application logic etc. While JSP is used for presentation only. Servlets have HTML codes in within java codes. While JSP is JAVA codes within HTML codes. Thats why JSP is lot easier in presentation.

rinkua at 2007-7-8 23:13:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
Servlet is like narrow way and Jsp is freeway..Which one you will choose to have a smooth journey
pichi_screena at 2007-7-8 23:13:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

> While JSP is JAVA codes within HTML codes

Actually, when doing it the proper way JSP's contain no java code at all, only content and custom tags, most likely from known taglibs such as JSTL, JSF, Struts, etc.

> But the servlets are used for request processing, implementing application logic

Servlets are not used to implement the application logic, you create other classes (DAO classes, POJO classes, Enterprise Javabeans, whatever you like to use) and call these from your servlets. This makes your application logic reusable.

gimbal2a at 2007-7-8 23:13:59 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...