File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes custom tag and beans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "custom tag and beans" Watch "custom tag and beans" New topic

custom tag and beans

veeramani velayutham

Joined: Dec 10, 2004
Posts: 11
what is the difference in using customs tag and beans.

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

Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
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.

“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63867

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.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: custom tag and beans
It's not a secret anymore!