This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi We all know that we should separate the business logic and presentation logic commonly found in JSP. This can be achieved by JavaBeans or Custom Tags Anyone knows when should we use JavaBeans or custom tags in JSP and what are the pros/cons and issues for each implementation ? Thanks in advance
I think custom tags can replace JavaBean components in all cases. The primary difference between them are
Beans can not manipulate JSP contents while custom tags can
With the use of custom tags the presentation logic and be separated from business logic completely.
Custom tags can be developed by a Developer and used by a designer while a designer can not use Beans if he does not know Java.
Joined: Aug 14, 2001
Hi Shamaila Yes, I agreed with you that "custom tags can replace JavaBean components in all cases". I may be wrong, but that's what I thought. If this is the case, then do we still need JavaBeans in web component developments ?
Joined: Aug 28, 2001
Kodo Tan: As i said earlier that custom tags can replace JavaBean components in all cases but i used Beans in the following cases
when I had to deliver some part of my project in a very short period of time
I older projects where JavaBeans where used and i had to change some part of it with out changing the jsp version.
I think beans are good tool for beginers and useful in rapid application development if do not want to complicate the process.
If I had to name one key difference between JavaBeans and tags, it would have to be that beans don't have access to the environment in which they run. JavaBeans are still very useful in web development as a way of representing the underlying data/business model, and also for storing state in the HttpSession for example. Here's a link to a BOF that I presented at JavaOne this year that might be of use... http://www.btinternet.com/~simon_g_brown/conferences/bof-1770.html Cheers Simon