Sunday, April 11, 2010

Difference between customTags and JavaBeans


  1. JavaBeans are the data handlers of JSP and aid in encapsulating data management logic. They are used for storage Tags on the other hand, aid computational logic related to a particular request. 
  2. Tags are thread safe; beans are not. Beans like other separate utility classes, have to be made thread safe by the developers. 
  3. Tags are aware of the environment (the page context) in which they execute. Beans are not. 
  4. Tags remain in the translation unit.We can think of tags as events occuring in the execution of a JSP page. Beans are object stores that reside outside the translation unit. 
  5. Tags can access implicit objects. Beans are cannot. 
  6. Tags only have page scope. They are created and destroyed withen a single request and in a single page. They can access other objects in all the scopes, though. Beans, on the other hand. Are themselves objects that reside in different scopes. Therefore, tags can access and manipulte beans, while beans do not access and manipulate tags. 
  7. The Tag Extension API designed closely with the concept of a JSP page in mind. They may not be used in other applications. Beans, on the other hand are supposed to be resuable compnents and can be used by other container. 
  8. Tags are not persistent objects. Beans have properties, and properties have values. A set of values is called the state of the bean. This state can be persisted via serialization and resued later.

No comments:

Post a Comment