| Author |
JSTL c:remove
|
stefania ferrarelli
Greenhorn
Joined: Jul 26, 2009
Posts: 29
|
|
Hi to all,
I noticed that <c:remove> cancels the value of an attribute only if the value was set by <c:set> but doesn't set the value to null if the same attribute already had another value, before changing it by the c:set.Does <c:remove> refers only to <c:set> setted values?Am I wrong?
Stefania
|
 |
Ankit Garg
Saloon Keeper
Joined: Aug 03, 2008
Posts: 9189
|
|
|
c:remove can remove attributes which were not set by c:set tag. How did you notice the behavior you are talking about??
|
SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1042
|
|
Hi Stefania,
Can you post the code that you are basing your question on?
<c:remove> - removes a scoped variable
If attribute scope is not specified, the scoped variable is removed according to the
semantics of PageContext.removeAttribute(varName). If attribute scope is
specified, the scoped variable is removed according to the semantics of
PageContext.removeAttribute(varName, scope).
Regards,
Frits
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1042
|
|
|
wow, caught by a few seconds....
|
 |
stefania ferrarelli
Greenhorn
Joined: Jul 26, 2009
Posts: 29
|
|
Hi Ankit and Fritz,
I understood my mistake on posting you my code, because I set a request scope on the tag but I had already set the attribute on session!! Even then I send you the code I wrote before:
I thought that after the jsp remove I should have had a null value, but I get the value I put in the HTML form:
elabora.java:
guarda.jsp:
Of course I'am following HFSJ on chapter 9 on page 458, not very original
Thank you!!
Stefania
|
 |
Frits Walraven
Rancher
Joined: Apr 07, 2010
Posts: 1042
|
|
Hi Stefania,
I also get mixed up every now and then. The EL-expression ${userStatus} just looks in all the scopes for that attribute.
When dealing with scopes you can use the following EL-expressions:
Regards,
Frits
|
 |
 |
|
|
subject: JSTL c:remove
|
|
|