This week's giveaway is in the Beginning Java forum.
We're giving away four copies of Bad Programming Practices 101 (e-book) and have Karl Beecher on-line!
See this thread for details.
Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP or servlet - how to decide  RSS feed

 
Ranch Hand
Posts: 202
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?
 
Saloon Keeper
Posts: 4559
115
  • 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.
 
Rancher
Posts: 3538
39
  • 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.
 
Author and ninkuma
Marshal
Posts: 66727
167
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.
 
This parrot is no more. It has ceased to be. Now it's a tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!