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 page 448 jstl doubt Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "page 448 jstl doubt" Watch "page 448 jstl doubt" New topic
Author

page 448 jstl doubt

Sami Sayeed
Ranch Hand

Joined: Oct 05, 2004
Posts: 39
Hi,

the page 448 describes how to use c:remove tag,

it states that the scope if not mentioned in the <c:remove var="blah"/>
resolves to page scope.

I have a program as follows
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<c:set var="user" scope="session" value="cowboy"/>

<c:set var="dog" value="tommy"/>
${dog}
${user}
<c:remove var="user"/>// the c:remove tag removes the user variable created under session scope even without me mentioning the scope..

<a href="testset.jsp">clcik to test</a>
Guido Schoepp
Greenhorn

Joined: Oct 14, 2004
Posts: 21
Originally posted by Sami Sayeed:

the page 448 describes how to use c:remove tag,
it states that the scope if not mentioned in the <c:remove var="blah"/> resolves to page scope.
[...]
<c:remove var="user"/>// the c:remove tag removes the user variable created under session scope even without me mentioning the scope...


You're right - the book is wrong.

The JSTL specs say: "If attribute scope is not specified, the scoped variable is removed according to the semantics of PageContext.removeAttribute(varName)."

And the API docs for JspContext.removeAttribut(String) say: "Remove the object reference associated with the given name from all scopes."

Guido
Kapil Dev
Greenhorn

Joined: Nov 11, 2004
Posts: 1
Guido Schoepp,

did you then mean that <c:remove var="user"/> will not remove the session scoped variable "user". Will this remove a request scope variable "user" if it did exist in the request scope?
Could you please explain?
Thanks.
Sami Sayeed
Ranch Hand

Joined: Oct 05, 2004
Posts: 39
Hi Kapil,

The c:remove var="user"/>
recursively removes all the varaibles of the name "user" in all scopes

cheers
Sami
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: page 448 jstl doubt