• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP or servlet - how to decide  RSS feed

 
raja singh kumar
Ranch Hand
Posts: 189
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. How do I decide if I should use JSP or servlet in my project?
2. If JSP is internally converted to Servlet what is the use of JSP? Why not write code in servlet instead of writing in JSP?What is the need for internal conversion to servlet?
 
Tim Moores
Saloon Keeper
Posts: 3957
94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In practice, you would use both together. Servlets are the controller (C) in a [wikipedia]Model View Controller[wikipedia] (a.k.a. MVC) architecture, whereas JSPs are the view (V).

There should never be code in a JSP, only tags, such as those from JSTL, or custom made ones.
 
Dave Tolls
Ranch Foreman
Posts: 3001
37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You would know why JSPs exist if you had ever attempted to write any webapp that's anything but the simplest possible.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66260
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Read this article to understand why it's never servlets or JSP, but servlets and JSP.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!