• 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

servlets&jsp

 
Ranch Hand
Posts: 251
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the exact differece between jsp and servlets?

I want the answer practically not bookish.

Thanks
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Do you have any idea as what was the reason for making jsp's which are eventually servlets?

Have you tried to write a servlet that would render a complicated HTML chunk.In this case you will notice that there are lots of HTML snippets within the servlet code.
Even the readability of the servlet code decreases.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A JSP looks like an HTML page and ideally has no Java on it (a rule I haven't learned how to follow, BTW) while a servlet looks like a plain Java class and has no HTML.

Servlets are very good for receiving inbound GET and POST requests and figuring out what business activity needs to run. Then they can "forward" to a JSP which formats the HTML response to the user.

This kind of thing is common:
 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While you delier your business application, servlets are delivered as .class files (source code not available for the end user) and JSPs are delivered as .jsp (source code available for the end user).

...One more reason to use only servlets (not JSP) for implementing only business logics.
 
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
JSP is a templating technology for building text-based respnses, most oftien HTML pages. It just happens to be built in servlet technology.
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi...

I have worked in a java crm designed and developed using servlets only....that was in cira 2000

Later we developed the same app in ASP and frankly ASP was like heaven

Now all html has to be embedded in servlets using out.println's

Try to embedded a complex html page with lot of javascript( Spice added)

into a servlets.

I promise you will be dreaming about single quotes/double Quotes and escape slashes

I think that will be really a pratical night mare...
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jsp
separate the presentation and business logic.(custom tags)
more easy to learn,easy to write
servlet
presentation and business logic in same place.
everything should embedd in out.println("") it is too complex to write is it?
 
reply
    Bookmark Topic Watch Topic
  • New Topic