Win a copy of Bad Programming Practices 101 (e-book) this week in the Beginning Java forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

c:remove custom tag  RSS feed

 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<c:remove var="s">cool</c:remove>

s is a session scoped attribute..
will this tag remove the session scoped attribute s?
 
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"remove" is not supposed to have a body.

Let's asuume that you remove the body. If you don't specify the scope in the "remove" tag, the process will be the same as calling PageContext.removeAttribute.
So check the API for removeAttribute, and you'll get your answer
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I agree with Satou kurinosuke.

c:remove will remove attrbutes in any scope.
It will only call : JspContext.removeAttribute(String attribute);
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So suppose if the attribute "s" exists in multiple scopes, only the first one encountered would be removed, or all of them would be removed?
 
Ranch Hand
Posts: 344
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in this case with scope page will be removed..
the order is page > request > session > application
 
Ranch Hand
Posts: 128
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So suppose if the attribute "s" exists in multiple scopes, only the first one encountered would be removed, or all of them would be removed?



All of them will be removed.
Accrding to API doc:

Remove the object reference associated with the given name from all scopes.

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please refer this Topic Confusion about "scope" attribute -- JSTL Thread

Thanks,
Seenikkannan.K

[ March 20, 2007: Message edited by: Seenikkannan krishnasamy ]

[ March 20, 2007: Message edited by: Seenikkannan krishnasamy ]
[ March 20, 2007: Message edited by: Seenikkannan krishnasamy ]
 
These are the worst of times and these are the best of times. And this is the best tiny ad:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!