Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Vs SERVLETS

 
Kishan Kumar
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Folks,
I am new to this area. Please answer questions below even if u find it too minute.
1. As a developer and designer what factors should be taken in to consideratio while deciding upon which to use JSP or SERVLETS.
How to weigh factors and take one among them or both.
2. Can all components be writtern in beans which can be called from JSP or is there any factors that makes servlets more suitable in place of component beans, I mean are servlets and beans replacable.
We have more presentation logic to be implemented that makes us go for JSP thats for sure. Above that for writing business logic can we just use beans for all and call them from jsp's or should
we write servlets and beans and call them from JSP's.
Please give me some ideas of how to start with selecting the technology.
Your help in this regards is highly appreciated.
Also please try to speak in laymans language.

------------------
Regards,
V. Kishan Kumar
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Remember that JSP is just a pre-processor for Servlets. JSP code is converted to a Servlet then compiled. The main differences are in the maintenance of the code. JSP, unless you are very careful, can end up with a strange mixture of code and HTML in the JSP files, which is hard for a Java programmer to deal with, and also hard for a web designer to deal with.
A good approach to take when making this sort of decision is to split the problem to as many small components as you can, and then decide for each one whether it is best as a JSP (good for easily-changed simple user interfaces which access simple bean-based data), a template for a template processing system like WebMacro (good for easily changed highly-graphich user interfaces which access potentially complex data), a bean (good for simple data with no user-interface at all), a servlet (good for the control aspects of a UI - deciding which other components do what, and in which order), or an aplication-specific Java class (good for complex processing and data structures accessed by the other types of component).
A typical web application structure might have some JSP files or templates which define the user interface pages, one or more simple servlets to route form data and url requests to the right classes, some beans which load themselves from application-specific classes and are rendered in the JSPs and a lot of application classes which understand about the problem domain and the business rules which underlie it. Terms used to describe this way of working include "Model 2 JSP architecture" and "Model-View-Controller".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic