Win a copy of Rust Web Development this week in the Other Languages forum!
  • 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

EL mapEntry.value prints Ljava.lang.String@

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ranchers,

I've got a problem with printing values from a map to my page.
My code is the following:



"myMap" is actually the map returned by request.getParameterMap(), that I put in a request attribute to be printed into this page.
According to API doc this should be a Map<String,String>.

However, what I get in my page is something like :


Why isn't the String value printed ??
[ March 14, 2007: Message edited by: Bear Bibeault ]
 
Julien Roubieu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, as always, we find the answer just after posting the question:
I had misread the API : the request.getParameterMap() method returns a Map<String, String[]>, to handle multiple parameters with the same name.

I just needed to add the array index to get my parameter printed :


<c:forEach items="${myMap}" var="e">
<input type="hidden" name="${e.key}" value="${e.value[0]}">
</c:forEach>



I hope this will help someone else...
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic