• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

custom tag and beans

 
veeramani velayutham
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the difference in using customs tag and beans.

which one is the best to use. can anyone give explanation.

regards
veeramani.v
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Custom Tags are more advanced and flexible than standard jsp tags, such as <jsp:useBean ../> Custom tag libraries make it possible to create business logic that is almost completely hidden from the presentation layer.

Beans, however, can also make for a cleaner, less cluttered JSP page. For example, a bean's properties can be automatically set by parameter values from a client request. Beans also have scope, which means they can be used per request, between pages, per session, or even throughout an entire application.

As far as which is better... well that depends on what you would like to do. Both beans and custom tags have their place in jsp.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both beans and custom tags have their place in jsp.


Indeed. In fact, the question doesn't make much sense to me. It's like asking "what's better in a Java class, variables or statements?"

Beans are used to hold information for a JSP page, usually as scoped variables. Custom tags, and standard tags such as the JSTL, are used to operate upon this data.

It isn't an either-or situation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic