• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL c:remove

 
stefania ferrarelli
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 9528
33
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
c:remove can remove attributes which were not set by c:set tag. How did you notice the behavior you are talking about??
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2438
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2438
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow, caught by a few seconds....
 
stefania ferrarelli
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Creator of Enthuware JWS+ V6
Saloon Keeper
Pie
Posts: 2438
95
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic