aspose file tools*
The moose likes Servlets and the fly likes what is better java servlet or jsp ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "what is better java servlet or jsp ??" Watch "what is better java servlet or jsp ??" New topic
Author

what is better java servlet or jsp ??

Sagar Surana
Greenhorn

Joined: Dec 23, 2000
Posts: 21
can anyone tell me what is the difference between
java servlet & jsp.
and which is the best of them?
thank'z in advance
bye.

------------------
Sagar Surana
optimist


Sagar Surana<BR>optimist
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
A JSP is just another way of constructing a servlet.
Choosing one or the other depends on what you are trying to create. If the HTML pages you want to create are heavy on the HTML and don't need much Java code, JSP is worth looking at.
If you creating functions that can be expressed as custom tags, JSP is what you want.
If your application involves a lot of decision making and branching, a servlet is what you need. You can also combine a decision making servlet with JSP pages that handle various specific types of output.
I suggest getting comfortable with writing servlets first so you can understand basic ideas and limitations of servlets. Servlets are easier to debug.
Bill

------------------
author of:
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
aren't servlets dying down with the advent of JSP. Doesn't a jsp engine comiple a JSP into a servlet after it is accessed the first time? If the jsp requires lot of branching and complex programming stuff, wouldn't creating a bean (multi-tier) and still using JSP not a solution?
Need clarification!!

Thanks
Zaeem
sandeep vijan
Greenhorn

Joined: Dec 28, 2000
Posts: 7
servlets are used for small projects.
for medium to large projects use jsp.

. ))<BR>. ((<BR>. C|~~|<BR>. `--'<BR>. JAVA
Danny Mui
Ranch Hand

Joined: Dec 14, 2000
Posts: 42
IMHO, Servlets should be only used as dispatch/processing modules (ie. posting to or some other specialized task).
JSPs should be used for presentation.
This argument is made because clients I've worked with don't necessarily agree with my web-designers and they work out the kinks. I don't want a web-designer mucking around in my servlet code, it's harder to totally ruin a JSP page. If they do, it's their fault haha .
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12769
    
    5
aren't servlets dying down with the advent of JSP.
NO! (Many people consider JSP to be Ugly Tech)
Doesn't a jsp engine comiple a JSP into a servlet after it is accessed the first time?
To be precise - WHEN it is accessed for the first time.
If the jsp requires lot of branching and complex programming stuff, wouldn't creating a bean (multi-tier)and still using JSP not a solution?
There is a near infinity of possible architectures, some people swear by a single servlet which takes all requests, decides what to do, and dispatches the request to the appropriate JSP for output.
Like everything else in computing - consider the task at hand, don't just blindly apply the current buzzword technology.
Bill
(Who personally writes pretty big servlets)
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944

Thanks Bill
Zaeem
 
jQuery in Action, 2nd edition
 
subject: what is better java servlet or jsp ??