• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

jsp:useBean usage

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am always confused about the use of <jsp:useBean> to create an object instance and the use of just simply a class in a package provided. Could anyone tell me the main difference? Giving examples and situation on why using <jsp:useBean> would be highly appreciated!
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Marco
I'm not a jsp or bean expert but if I understand your question correctly you want to know why to use a bean instead of a regular class.
To be a bean a class meets certain specific requirments, such as accessor methods, that may or may not be in another class. Because of this you can use things like this:
That you wouldn't be able to use with a normal class. I'm sure there are other benefits too that I'm not aware of. someone else can probably give you a better explaination.
 
author
Posts: 3252
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
useBean
  • Removes some Java code from the JSP. JSPs should, in most cases, ideally have no Java code at all.
  • Retrieves rather than instantiates the bean if it already exists in the specified scope.
  • Binds the bean in the specified scope after instantiation.
  • Makes the bean available to actions such as get/setProperty, and to custom tags.
  • Hope this helps,
    - Peter
     
    Where does a nanny get ground to air missles? Protect this tiny ad:
    the value of filler advertising in 2021
    https://coderanch.com/t/730886/filler-advertising
    reply
      Bookmark Topic Watch Topic
    • New Topic