• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP vs Servlets

 
Ranch Hand
Posts: 980
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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


Precisely my point
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic