Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference between usebean and just create an object

 
Cynthia Yao
Ranch Hand
Posts: 92
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

I just need to clarify something.
What is the differences between using <jsp:UseBean> tag and just simply in <%%> create an bean object and do the modification?
Thanks in advance
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13077
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The big difference has to do with the scope of the bean - any old object you create will just have the scope of the page, but you can specify that a bean will have request, session or application scope.
So - if have a session scope bean and your tag gives the name of a bean that was already created in the session, <jsp:useBean will automatically get that existing bean object for you.
Of course you can accomplish the same thing with code you write yourself, like most JSP goodies, its a convenience thing.
Bill

------------------
author of:
 
Raghav Mathur
Ranch Hand
Posts: 641
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
there is small diff ....the <% %> tag is used to write the java code in the jsp page and the useBean tag is use to call the beans to the jsp page .
Originally posted by Cynthia Yao:

I just need to clarify something.
What is the differences between using <jsp:UseBean> tag and just simply in <%%> create an bean object and do the modification?
Thanks in advance

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic