Win a copy of Node.js Design Patterns: Design and implement production-grade Node.js applications using proven patterns and techniques this week in the Server-Side JavaScript and NodeJS forum!
  • 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

MVC - Controller

 
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why in MVC the controller is Servlet ? Why can't we use JSP for control as in turn it becomes servlet.
Is there any other benefit using servlet?
Regards,
aakash
 
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by aakash bhatt:
Why in MVC the controller is Servlet ? Why can't we use JSP for control as in turn it becomes servlet.
Is there any other benefit using servlet?
Regards,
aakash


My $0.02
Since JSP should be used for presentation logic only, it makes more sense to use a servlet as a controller. Servlet process business logic and should be pure java code. But I've also seen cases in which you can use a JSP as a controller. Have a look at
this article, there's a jsp named process.jsp that acts as a controller.
Notice also that it does not have any presentation at all (HTML). It's got pure java code to forward the request to the appropiate destination.
HTH
[ September 16, 2003: Message edited by: Andres Gonzalez ]
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you design your JSP poorly, it is possible for white space to 'leak' into the output buffer. As long as you remain under the buffer size you'll never know, but this is slightly less efficient.
I have encountered the case where there was so much white space, the buffer was comitted and they were unable to forward. This was an extreme case, but it just won't happen in a Servlet.
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1 minute? Damn you Andrew Monkhouse!!! (need a 'shaking your fists at the sky' emoticon)

 
Andres Gonzalez
Ranch Hand
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David O'Meara:
1 minute? Damn you Andrew Monkhouse!!! (need a 'shaking your fists at the sky' emoticon)


Andres Gonzalez
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Stone the crows, how did that happen?
Still, wouldn't you prefer I blamed him?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic