• Post Reply Bookmark Topic Watch Topic
  • New Topic

Which to use when?  RSS feed

 
Prash Singh
Ranch Hand
Posts: 103
jQuery Netbeans IDE Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,

Please tell me, in which situations to make a servlet and in which a JSP.

Thanks in Advance.

 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In an MVC architecture, they each have their own distinct purpose. Servlets are used to process a request, while JSP are used to display some data. Check this FAQ.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this article.
 
Kaustubh G Sharma
Ranch Hand
Posts: 1283
Chrome Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In MVC or any other framwork basically JSP is used to create view part while servlet deals with control. JSP code day by day replacing with some custom tags or taglib just to make it free from java code so that web designer who don't know java can perform his/her task while at servlet end java code is used by the coder to flow the data and control.Well this is the basic difference between them hope this will clear your problem so you can deal with JSP and servlet.

Kaustubh
 
Prash Singh
Ranch Hand
Posts: 103
jQuery Netbeans IDE Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks to everyone.
 
Prabhat Shankar
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prash Singh wrote:Dear all,

Please tell me, in which situations to make a servlet and in which a JSP.

Thanks in Advance.



Prash Singh,


JSP should be used only for view part and servlet you should go for writing business logic in web application.

Always avoid to write business logic inside JSP that should be only for view part.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!