• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP vs Servlets  RSS feed

 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Can u tell me whats the advantage ogf JSP over servlets...

since the JSP are again converted into servlet.

And the conversion itself makes use of the resources...

I know that JSp allows u to have neat code,separate presentation..

but this is all from a programmers point of view...


I meant from a performance oriented....how???

Thanks in advance,
A Kumar.
 
Yu Tao
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK~~
do you know MVC???

jsp is view .

in you system,jsp only have one function is view.(to show you some data.)

Servlet is Control

in you system.Servlet can request you page form and deal with the form.
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

Yes i do know MVC...


yes servlet play the part of controller...but in MVC architecture...

but what about other times...


Thanks once again.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is no servlet OR JSP, for best effect you will always (make that usually, there are alternatives to JSP you can consider) use both in combination (if you need a text-based user interface that is).
[ December 20, 2004: Message edited by: Jeroen Wenting ]
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the inputs
but my Q still remains...

Whats the adv of JSP in comparison with the servlets...

from the point of an applicatiopn performance?

Thanks in advance
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

OK~~
do you know MVC???

jsp is view .

Well, its only the view if you use it as such. You can quite easily put code which behaves like a controller in a JSP.


Whats the adv of JSP in comparison with the servlets...

from the point of an applicatiopn performance

There is no advantage for one over the other in performance. JSP is a markup technology which allows the autogeneration of Servlets. So both rely on the same underlying technology.
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can quite easily put code which behaves like a controller in a JSP
But remember, just because you can doesn't mean that you should. I am from the school of thought that the less code in a jsp the better. Especially now with EL becoming more commonplace. Also, seperating your view and controller (as in MVC) makes for a more modular application.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

But remember, just because you can doesn't mean that you should

Precisely my point
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66153
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Additionally, I'd advise to stop focusing on performance as the major factor in such a technology choice. It's like choosing which vehicle to buy based upon its performance running the 1/4 mile. If the main thing you are trying to do is to haul cinder blocks, choosing a Dodge Neon RT (which will eat up a quarter mile like you wouldn't believe) over a Dodge Ram is a poor choice.

Similarly, JSPs are great for rendering views, and not so great on performing processing. Servlets are great for processing, not so great on rendering views. Use each technology to their own strengths and less on how you think they might perform.
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's like choosing which vehicle to buy based upon its performance running the 1/4 mile.
Great analogy Bear.
 
Venkatraman Kandaswamy
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSPs are converted to servlets - but this is done only once - the first time a request arrives - and not for every subsequent request. So performance wise JSPs and servlets are the same. When you factor in the advantages of having EL, tags, better code readability its a no-contest win for JSPs - when it comes to views.

isnt it so?
 
A Kumar
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Thanks for airing your views...

I appreciate them all....Indeed it has cleared the air


Bye,
A kumar.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!