• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaBeans Vs Custom Tags

 
Kodo Tan
Ranch Hand
Posts: 105
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Tahir Mansoori
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Java Beans are purely used for business logic at middle tier. You develop custom tags for common tasks in dynamic content generation for dispaly and processing.
 
Shamaila Mahmood
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think custom tags can replace JavaBean components in all cases.
The primary difference between them are

  1. Beans can not manipulate JSP contents while custom tags can
  2. With the use of custom tags the presentation logic and be separated from business logic completely.
  3. 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.

 
Kodo Tan
Ranch Hand
Posts: 105
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Shamaila Mahmood
Greenhorn
Posts: 16
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
faiza haris
Ranch Hand
Posts: 173
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey !
does the link specified work? doesnt work for me???Plz check!
Faiza
 
Carl Trusiak
Sheriff
Posts: 3340
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simon, btinternet.com changed how things are stored. I think you want to show http://www.simongbrown.com/conferences/bof-1770.html
 
Simon Brown
sharp shooter, and author
Ranch Hand
Posts: 1913
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Carl ... I switched my webspace and the btinternet.com links have now disappeared.
 
faiza haris
Ranch Hand
Posts: 173
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanx Carl!!
faiza
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic