This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark ""c:set target" but no scope?" Watch ""c:set target" but no scope?" New topic

"c:set target" but no scope?

Ner min
Ranch Hand

Joined: Sep 14, 2005
Posts: 76
is it true that when using "c:set target" there is no scope attribute?
if i have
request.setAttribute("mymap", new java.util.HashMap());
page.setAttribute("mymap", new java.util.HashMap());
<c:set target="${mymap}" property="surname" value="145"/>
this always sets the mymap in page Scope
if i try
<c:set target="${mymap}" property="surname" value="145" scope="request"/>
i allways getting an error:
Illegal scope attribute without var in "c:set" tag.
how can i differentiate the scopes when using "c:set target" ?
[ September 29, 2005: Message edited by: Ner min ]
Ner min
Ranch Hand

Joined: Sep 14, 2005
Posts: 76
he he, i got it. it is simple:
<c:set target="${requestScope.mymap}" property="surname" value="145"/>
Rizwan Mohammad
Ranch Hand

Joined: Sep 02, 2005
Posts: 445
always target should evaluate to OBJECT. It is not id of a attribute or bean. It should always evaluate to either java bean or hashmap. SO target should always have some script expression or EL.

I agree. Here's the link:
subject: "c:set target" but no scope?
jQuery in Action, 3rd edition