• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How Code Resuability easy in servlet

 
Rajendra Prakash
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi friends am newbie to servlet. How code reusability easy in servlet. why not in jsp .
here reusabillity means only javabeans or any thing else.
 
ujjwal soni
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Servlet was developed to execute the business logic. You can develop EJB, or Java Beans to process the business logic. So, you can reuse the same business logic in many different place. So, in servlet you can re-use the already developed business logic multiple times. Here the resuability means the re-use of business logic in the form of Java Beans/EJB etc.

JSP is developed to develop the view of the application. You are not supposed to write business processing logic in JSP.
 
Tim Holloway
Saloon Keeper
Posts: 18300
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The main problems with reusability have to do with how dependent the code is on the environment in which it was originally used. If you put the actual business logic in a generic JavaBean and employ that JavaBean from the servlet, the business logic would tend to be more reusable than if you'd placed it directly in the servlet. This concept is known as "separation of concerns".
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13073
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A further benefit - if you design your helper classes (beans or whatever) so that they can be tested outside the servlet environment you will find development much easier.

Bill
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic