This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
I have four objects in four different scopes [page,request,session,application].
And I use: <c:remove var="popy"/>
In the absence of the scope attribute it removes the objects from all the four scopes.
If it is required to remove the object from the session scope won't <c:remove var="popy"/> be correct answer too, because it starts from page and goes on goes on, finding and removing objects of that name from the scopes?
Because the requirement is to remove it from session. Not from all the scopes.
Just imagine of the havoc, it can create in a running application. If by mistake instead of writing <c:remove var="popy" scope="session"/> you write <c:remove var="popy"/>
Objects in the other scopes might being used somewhere else in the application.
So it always better to be specific.
And in exam, I think it will depend on the number of options to be choosen.
Regards, Khushhal
rgrds,
Khushhal
Chandra Bhatt
Ranch Hand
Joined: Feb 28, 2007
Posts: 1707
posted
0
Thanks khushhal,
Yeah it is was I was looking for! It would depend on how many options we have to choose, but we should be very specific. Alright!
Thanks,
Srinivasan thoyyeti
Ranch Hand
Joined: Feb 15, 2007
Posts: 557
posted
0
Chandra,
You are absolutely correct.
Given options 1. <c:remove var="poppy"/> 2. <c:remove var="poppy" scope=session/>
if (asked to select one which will delete poppy from session only) { then choose 2. } else{ if (asked to select two from following which can delete poppy from session) then choose 1,2. } [ August 14, 2007: Message edited by: Srinivasan thoyyeti ]
Thanks & Regards,<br />T.Srinivasan,<br />SCWCD 1.4(89%),SCJP 5.0(75%)<br />"That service is the noblest which is rendered for its own sake." - Mahatma Gandhi
Chandra Bhatt
Ranch Hand
Joined: Feb 28, 2007
Posts: 1707
posted
0
Yeah Srinivasan,
That would be right way to handle with that sort of question.
Chandra, thank you for your post that pointed out the in the absence of a scope attribute in the <c:remove> tag, the scope is all scopes. On page 448 pf HFSJ it says that the default scope is page. I missed the correction in the errata of the book
{448} 2nd handwritten comment; The scope is optional, and like always - page is the default scope. should be: The scope is optional, and when not specified the attribute is removed from all scopes.
In appreciation of your post, I have written a JSP that points out what you wrote. Here it is