Difference between custom tag and Java Bean?

Difference between custom tag and Java Bean?

+4
source share
4 answers

The custom JSP tag must be interpreted and run inside the JSP; Java Bean is not working.

The JSP custom tag should extend the javax.servlet.jsp.tagext.Tag interface; Java Bean is not working.

A custom JSP tag may use another Java Beans to do its job, but the opposite is not true.

+3
source

Custom tags have access to implicit objects such as request, response, session, etc. JavaBeans are normal Java classes and do not know anything about JSPs.

Javabeans are commonly used to support data and custom tags for functionality or implementation of logic on a jsp page.

+1
source

Custom tags have access to all implicit objects. JavaBeans are Java classes, but all java classes are not java beans. The main thing - a custom tag can use java beans to exchange with each other.

+1
source

Further

  • Custom tags can manage JSP content; beans cannot.
  • Complex operations can be reduced to a much simpler form with custom tags than with beans.
  • Custom tags require a bit more work to configure than beans.
  • Custom tags typically define relatively stand-alone behavior, while beans are often defined in one servlet and used in another servlet or JSP page.
  • Custom tags are only available in JSP 1.1 and later, but beans can be used in all versions of JSP 1.x.
0
source

All Articles