File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes JSTL c:remove Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "JSTL c:remove" Watch "JSTL c:remove" New topic
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
Sheriff

Joined: Aug 03, 2008
Posts: 9291
    
  17

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
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1636
    
  23

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
Bartender

Joined: Apr 07, 2010
Posts: 1636
    
  23

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
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1636
    
  23

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
 
Similar Threads
c:remove does not remove from all scopes
Question about JSTL (c:remove)
How does c:remove scope=... work?
c:set var question
Remove and Set