Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Regarding JavaBean in JSP  RSS feed

 
Nagarajan Krishnamurthy
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the differnce between using "jsp:usebean" tag and instantiating a bean using its constructor in a JSP page?
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The amount of code you have to type.

The useBean tag will check the specified scope to see if the bean already exists, if not, it will instanciate it, create an object variable that points to it, and then bind it to the specified scope for you.
All with one line of code (tag).



[appended]
By the way, if you want to know exactly what the difference is, create a JSP page that instanciates two beans -- one by hand, the other with useBean.
Run it. Then go look at the generated source and compare the code for each.
[ July 14, 2005: Message edited by: Ben Souther ]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!