• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt in JSTL

 
Ranch Hand
Posts: 205
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all

I tried the following just out of curiosity.
In JSTL we have "target" attribute in <c:set> tag. "c" is just a prefix used over here for example.This "target" accepts maps or beans as a value.

Map map = new Hashtable();
map.put("A","A");
map.put("B","B");
map.put("C","C");
map.put("D","D");
request.setAttribute("map",map);

then I used the following sentence
<c:set target="${map}" property="Hello" value="bye"/> The key value pair was successfully added to map. However I tired using "requestScope" object which is also a map but is an implict EL object

<c:set target="${requestScope}" property="Hello" value="bye"/>

However I got exception at runtime. Am I not allowed to make an entry in requestScope using <c:set> tag ?

Waiting for your suggestions.

Regards
Rohit.
[ November 30, 2005: Message edited by: Rohit Bhagwat ]
 
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
target attribute accepts an Object which should either be a Map with (name/value) pairs or a Bean with properties

To set a attribute in request scope you got to use different set of attributes available in <c:set> tag
<c:set var="Name" scope = "request" value="Rohit" />
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic