• 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

page 446 target value as array?

 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi in book they say that c:set var is for bean and maps and that it have to take string. Thats ok.
but they say to that c:set target os for lists and arrays???

so in my jsp i made
<%
String[] language={"asp","jsp","php"};
%>
and then
<c:set target="${language}" property="0" value="aspNet"/>
but it does not work. Anyone knows how to access array index via c:set target?
 
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ner,


<c:set var="var" value="asp" />
is for setting attributes.

<c:set target="${myBean}" property="name" value="jsp" />
is for setting beans and maps.



The above is not a bean, is it not?
Esam
[ September 23, 2005: Message edited by: Esam Ahmed ]
 
Ner min
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u r asking questions

i would say no it i an array, right?
 
Ner min
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tnx, ok i got that, but then is a tipo in a book they say (page446)
c:set var is for bean and maps and thet c:set target is for lists and arrays
[ September 23, 2005: Message edited by: Ner min ]
 
Esam Ahmed
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ner,
Are you mixing up the EL [] operator with <c:set target="{myMap}" property="theKey" value="newValue" />

As far as I know, for EL [], you can use Bean, Map, Array and List.
For, the Dot (.), you can use Bean and Map.

But for <c:set var> and <c:set target>, my previous post holds.

Esam.
 
Ranch Hand
Posts: 122
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Ner,
<c:set> with target attribute is for map or bean. If the el given for the target attribute returns anything other than a bean or a map, the container throws an exception. <c:set> with var attribute is for setting a new value or updating the value for an existing attribute in any scope.

No where is the context of a list or an array coming into picture.

Correct me if I am wrong!!
Srini

 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic