Forums Register Login

Default scope

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
Thanks once again!
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
See these, your doubts will be clear.

<jsp:getProperty>
<c:forEach>

Regards,
Khushhal
Did you miss me? Did you miss this tiny ad?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 531 times.
Similar Threads
Reason for change of scope from request to page
c:set scope option
Not able to retrieve the request attribute that was set using c:set tag.
Prototype spring bean destruction
jsp:useBean tag question
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 15, 2024 23:52:48.