• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

How Code Resuability easy in servlet

 
Ranch Hand
Posts: 293
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 25483
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
A feeble attempt to tell you about our stuff that makes us money
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic