| Author |
how to use scope in target version of c:set
|
Praveen Sharma
Ranch Hand
Joined: Jul 31, 2008
Posts: 127
|
|
Hi,using the target version of c:set how can I set the value of a property of a bean which is stored in request scope ? In my servlet I have the following code : Employee emp = new Employee(144142,"John"); //new Employee(Id,name) request.setAttribute("emp", emp); In my JSP I am trying to do this : <c:set target="${emp}" property="id" value="13345" scope="request" /> <c:set target="${emp}" property="name" value="Tom" scope="request" /> But I get the following error in TomCat : Illegal scope attribute without var in "c:set" tag
|
SCJP 80% SCWCD 89%
|
 |
Lakshmi Narayanan
Ranch Hand
Joined: Apr 29, 2008
Posts: 58
|
|
|
I believer only var has Scope Attribute not Target.
|
Thanks<br />Lakshmi<br />SCJP 1.4 - 90%<br />SCWCD 5 - 89%
|
 |
Atul Samnerkar
Ranch Hand
Joined: Sep 20, 2003
Posts: 44
|
|
Refer to https://issues.apache.org/bugzilla/show_bug.cgi?id=15703 Seems this is known bug. Cheers... Atul Samnerkar
|
 |
Praveen Sharma
Ranch Hand
Joined: Jul 31, 2008
Posts: 127
|
|
|
So that means, I can use target version of c:set only when the object is stored in the page scope ?
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14670
|
|
Seems this is known bug.
No, this bug is about fmt:setLocale. The c:set tag does not allow a scope when the target attribute is used. Why would you need a scope, as you are passing the object in the target ? With a bean, you'll specify the scope in the useBean tag.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Praveen Sharma
Ranch Hand
Joined: Jul 31, 2008
Posts: 127
|
|
Got it !! Thanks Christophe
|
 |
 |
I agree. Here's the link: jrebel
|
|
subject: how to use scope in target version of c:set
|
|
|