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

Reason for business logic in servlets only

 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why business logic written using servlets not in jsp. Jsp used for presentation purpose. serlvet used for coding business logic and controller logic. Reason for using servlets in business logic.
 
Srikkanth Mohanasundaram
Ranch Hand
Posts: 243
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please take a look at this. JspOrServlets
 
Vikash Ananda
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rajendra,

As you have seen Servlets and JSP. Writing Java Code in Servlet classes is easier than to write in JSPs. Similarly writing HTML codes within Servlets are cumbersome task. Just for clarity of things and to make applications more readable and more maintainable we follow more of MVC-2 design. This provides clear separation of UI and code. However this is not mandatory but If you follow this then your life will be easier.

Thanks,
Vikash
 
avi sinha
Ranch Hand
Posts: 453
Google Web Toolkit Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also note that there are some things JSPs can't do, e.g. generate (or stream) binary content. For those, servlets must be used


from the above link

avi sinha
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65338
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a properly structured web application, the business logic won't be in the servlets either. It will be in its own lower layer that is completely agnostic of the UI. Look up the concept of Separation of Concerns.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic