This week's book giveaway is in the Android forum.
We're giving away four copies of Learning Java by Building Android Games and have Jean-Marcel Belmont on-line!
See this thread for details.
Win a copy of Learning Java by Building Android Games this week in the Android 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • Devaka Cooray
Saloon Keepers:
  • Ganesh Patekar
  • Tim Moores
  • Carey Brown
  • Stephan van Hulst
  • salvin francis
Bartenders:
  • Ron McLeod
  • Frits Walraven
  • Pete Letkeman

JSP or servlet - how to decide  RSS feed

 
Ranch Hand
Posts: 209
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: 4845
117
  • 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.
 
Master Rancher
Posts: 3671
40
  • 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: 66819
168
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!