wood burning stoves 2.0*
The moose likes Servlets and the fly likes Differnce between Use bean and java instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Differnce between Use bean and java instance" Watch "Differnce between Use bean and java instance" New topic
Author

Differnce between Use bean and java instance

chinnu chinnu
Greenhorn

Joined: May 18, 2005
Posts: 4
difference between <jsp:usebean/> and creation of java class instance in jsp?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Usebean instanciates classes for you.

It takes care of
  • Looking to see if the bean already exists in the specified scope.
  • Instanciating it if it doesn't find it.
  • Binding it to the specified scope.
  • Creating a variable for you to use to refer to the bean.
  • Optionally setting properties only when instanciating if you add setProperty tags to the useBean tag's body.


  • Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
    chinnu chinnu
    Greenhorn

    Joined: May 18, 2005
    Posts: 4
    what i mean that ..between usebean and Instance of java class which one is preferable and why?
    Ben Souther
    Sheriff

    Joined: Dec 11, 2004
    Posts: 13410

    If you're interested in writing code without scriptlets in it, useBean is the way to go. Even if you're not, it's still a convenient way to do all the things mentioned above with a single tag.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Differnce between Use bean and java instance
     
    Similar Threads
    where have analysie java programe tool??
    Diff between instance variable and class variable
    Variables in Java
    object Vs instance
    static variables - belong to the class.