• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

how to use scope in target version of c:set

 
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believer only var has Scope Attribute not Target.
 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Refer to https://issues.apache.org/bugzilla/show_bug.cgi?id=15703
Seems this is known bug.


Cheers...
Atul Samnerkar
 
Praveen Sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So that means, I can use target version of c:set only when the object is stored in the page scope ?
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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.

 
Praveen Sharma
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it !! Thanks Christophe
 
Space pants. Tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic