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

Can we have jsp:getProperty without jsp:useBean

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems to me that <jsp:getProperty> can be used without a <jsp:useBean>. In this case, the tag just do a pageContext.findAttribute() to locate the named bean. If this is true, why would we ever need a <jsp:useBean>? Why it is there?
 
Ner min
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if u use <jsp:useBean> , if the bean is not there it will be created
 
MI Mohammed
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Imagine you want to pass the attribute between request,session and application scope. There most be a way to give the attribute a unique
id. then with that voila, it can be accessed outside the default page scope.

Hope it help.Curiosity is the brother of invension.


SCJP SCJA
:roll:
 
MI Mohammed
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pls substitute attribute with properties.

Thanks
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If we had only <jsp:getProperty> tag in the JSP it's almost like having an undeclared variable.

<jsp:useBean> is a way of declaring and initializing the actual bean object you are using in <jsp:getProperty>.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic