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

doubt about useBean

 
Kiril Nugmanov
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I'm wondering about useBean standart action. Which of it's attributes are mandatary?

I'm thinking that id and scope (according Java spec.):


type and class are optional because either type either class or even both can be used.

Am i right??
 
Sandeep Bhandari
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you are right. Even the exam may have a question on the same concept like choose the mandatory attributes of jsp:usebean
 
Bosun Bello
Ranch Hand
Posts: 1511
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One of class or type must also be specified though.
 
Kiril Nugmanov
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But neither class nor type are mandatory.

Thanks for reply.
[ November 21, 2008: Message edited by: Kiril Nugmanov ]
 
Christian Nicoll
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is the scope-attribute really mandatory, and means mandatory the same as required, because I think it is not required to have the scope-attribute.

The default value for the scope-attribute is page, so if I don't use another scope, page is used.

The statement is my eyes perfectly legal.
 
Zulfikar Dharmawan
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I think scope is not mandatory, because without being stated it is put default as page, but class or type is needed otherwise the id does not refer to anything.
 
sudipto shekhar
Ranch Hand
Posts: 826
Chrome Eclipse IDE Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Scope is not mandatory.
The default scope is page scope.
If it can not find the attribute in the page scope then the next scopes in order of their precedence are searched for namely in page scope ,then in request scope, then in session scope and then in application scope. And if it does not find one then it creates one in the page scope.
 
Sandeep Bhandari
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The confusion of whether class and type are mandatory is usually resolved by the exam by giving the statement like:

"If you want to create a bean"

"A servlet has set a bean in session scope, how will you use that bean"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic