File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes EL mapEntry.value prints Ljava.lang.String@ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "EL mapEntry.value prints Ljava.lang.String@" Watch "EL mapEntry.value prints Ljava.lang.String@" New topic

EL mapEntry.value prints Ljava.lang.String@

Julien Roubieu

Joined: Nov 16, 2005
Posts: 10
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

Joined: Nov 16, 2005
Posts: 10
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]}">

I hope this will help someone else...
I agree. Here's the link:
subject: EL mapEntry.value prints Ljava.lang.String@
It's not a secret anymore!