This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Differnce between Use bean and java instance

 
chinnu chinnu
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
difference between <jsp:usebean/> and creation of java class instance in jsp?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

  •  
    chinnu chinnu
    Greenhorn
    Posts: 4
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    what i mean that ..between usebean and Instance of java class which one is preferable and why?
     
    Ben Souther
    Sheriff
    Posts: 13411
    Firefox Browser Redhat VI Editor
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic