JavaBeans or Custom Tag Libraries: Tips on Usage

JavaBeans and custom tag libraries are two different approaches to the same problem: how to extend the Java code on the JSP page. Since we would like to keep the use of scriptlets on the JSP page to a minimum, we need some mechanism to make use of Java helper classes on the JSP page. JavaBeans provide this capability in such a way that almost any valid Java class could be made into a JavaBean. The only requirement is that any properties accessed using the JSP getProperty or setProperty tag would require the coding of get and set methods in the class, using a specific naming convention, but this is not required.

The use of tag libraries with JSP pages is more restrictive in terms of the coding effort ...

Get J2EE™ and Beyond: Design, Develop, and Deploy World-Class Java™ Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.