• 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:

Error in c:set tag

 
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've a strange errore while using the <c:set> tag.
I'm trying to setting a new value in an element of a Map but when i execute the jsp i receive this error : javax.servlet.jsp.JspTagException: Invalid property in <set>: "first"

My tomcat version is : 5.0.19 and my jdk version is : 1.4.2_03

This is part of the code of my jsp:
************************************************+
<% Map m = new HashMap();
m.put("first","f");
%>
<c:set var="myMap" value="<%=m%>" scope="page" />
<c ut value="Map In Page scope: " />
<c ut value="<%=pageContext.getAttribute("myMap")%>" default=" Map not in page scope" />
<BR>
<c ut value="Class: " />
<c ut value="<%=pageContext.getAttribute("myMap").getClass()%>" default=" Map not in page scope" />
<BR>
<c ut value="New Value for the element with key = first: " />
<c:set value="firstVal" target="myMap" property="first" />
<c ut value="${pageScope.myMap.first}" />
***************************************
If i delete the last three instructions the code works fine and i can see the initial map entry displayed in the output page

Can anyone tell me what is wrong with my code ?

Thank you.
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
the target attribute must be used with ${}
So, your tag must look like
<c:set value="firstVal" target="${myMap}" property="first" />
 
Paolo Metafune
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Sergey, now it works.

Bye.
 
I am not young enough to know everything. - Oscar Wilde This tiny ad thinks it knows more than Oscar:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic