This week's book giveaway is in the Agile and Other Processes forum.
We're giving away four copies of The Little Book of Impediments (e-book only) and have Tom Perry on-line!
See this thread for details.
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

Default scope

 
preeti venugopalan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks..
PLease clarify my doubts that's explained below..
1) In case of jsp:getProperty ..if the scope is not mentioned then container will start searching for the property of the bean starting from page scope then request, session and the application

2) In case of <c:forEach> if the scope of the items is not mentioned then does the container follows the same rule as mentioned in point 1 or it just searches the object page scope and stops

Thanks in advance
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Preeti

There is no scope attribute there for JSTL action <c:forEach>.
Why is it not there, I would like to know from you.
And for your query yes, it searches for all the scope from least restrictive to most restrive if you supply value items attribute as an EL expression.

And also there is no scope attribute for <jsp:getProperty> action.
It's only for <jsp:useBean> action among bean actions.
And if scope is absent in this action, it searches only in page scope.
If it can't find, it creates one or throw exception depending upon the attributes passed.

Regards,
Khushhal
 
preeti venugopalan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Khushal..

Thanks for the reply ..but i guess there is one correction..the container does not search from least restrictive to most restrictive....it's the vice versa ie page then request,session,application..right???
And in HFSJ in page 355 the first 2 lines says...
"If you don't specify scope in either the <jsp:useBean> or <jsp:getProperty> tags, the container uses the default of "page".
so doesn't that mean that we can specify a scope attribute in <jsp:geProperty>..Please correct me if i'm wrong!
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Preeti,

Yes you are right, I did mistake in writing.. It searches from page to application. Actually wanted to write most restrictive to least restrictive. But wrote opposite of that. Sorry for that

But Preeti only two attributes that are availble for <jsp:getProperty> and they are name and property. There is no scope attribute for <jsp:getProperty>. I am damn sure about it. You can verify it from anywhere.

Regards,
Khushhal
 
preeti venugopalan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks once again!
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Preeti

One more thing that I didn't tell you in first chance.
There is no scope attribute there for JSTL action <c:forEach>.
Because
See the scope attribute indicates the visibility or scope of var attribute.
But in case of <c:forEach>, var is defined only within the <c:forEach></c:forEach>. So there is no significance of having scope attribute.

Regards,
Khushhal
 
khushhal yadav
Ranch Hand
Posts: 242
Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See these, your doubts will be clear.

<jsp:getProperty>
<c:forEach>

Regards,
Khushhal
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic