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 c:set using var Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "c:set using var" Watch "c:set using var" New topic
Author

c:set using var

Naresh Chaurasia
Ranch Hand

Joined: May 18, 2005
Posts: 356
<c:set> using var can create new request-scoped attribute. My question is that does request-scoped attribute means that the scope of the reques is request and we cannot specify other scopes for the attribute. Please correct me if i am wrong


SCJP 1.4, SCWCD1.4, OCA(1Z0-007)
Srinivasan Rengan
Ranch Hand

Joined: Nov 07, 2004
Posts: 122
An attribute can be set at any of the four levels(request,session,application or page) using <c:set>. It is not restricted to the request scope alone.

Srini


SCJP, SCWCD, SCBCD (EJB 2.x and EJB 3), OCA, SCDJWS
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
you can use scope attribute to set the scope. default one is page scope.


Rizwan
SCJA, SCJP, SCWCD, SCBCD, SCDJWS.
Nicky Eng
Ranch Hand

Joined: Mar 26, 2005
Posts: 378
Originally posted by N Chaurasia:
<c:set> using var can create new request-scoped attribute. My question is that does request-scoped attribute means that the scope of the reques is request and we cannot specify other scopes for the attribute. Please correct me if i am wrong


are you trying to say something like this:

<c:set var="cart" scope="request" scope="session" />

where 2 scope inside the c:set ??

i dont think this can work. It can either :

<c:set var="cart" scope="request" />
OR
<c:set var="cart" scope="session" />
OR
<c:set var="cart" scope="page" />
OR
<c:set var="cart" scope="application" />

am i correct?


From NickyEng
Diploma in Computer Studies
SCJP 1.4
SCWCD 1.4
Formula 1 app by Maxis (Playbook)
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
scope is one of the attribute of set tag.
<c:set var="id" value="100" scope="session">
is equivalent to session.setAttribute("id", "100");
if you dont give scope attribute then it is equivalent to
pageContent.setAttribute("id","100");
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: c:set using var
 
Similar Threads
HFSJ 2ed - about <c:set>
Regarding JSTL1.1-JSP 2.0-TLD
Headfirst Servlets and Jsp <c:set> pg.457
target attribute of c:set
Confusion about "scope" attribute