Hi C

As Map stores values as Kay and Value pair. Where type of value is
Object. Here I am asking to Cast Object to String or call object
toString method. 

Nitin 

-----Original Message-----
From: Christopher Schultz [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, November 07, 2006 10:51 AM
To: Struts Users Mailing List
Subject: Re: request.getParameterMap

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Nitin,

> From: temp temp [mailto:[EMAIL PROTECTED]
>       How can I translate    value [Ljava.lang.String;@1849daf to
> readable String?

Nitin M. Mandolkar wrote:
> Cast it to String object. 

This won't work. Casting String[] to a String will result in a
ClassCastException, which does not yield the desired result.

The shortest code you can use to produce nice output for a string array
is this:

System.out.println(java.util.Arrays.asList(stringArrayObject));

In order to get all of your request params to print like this, you might
try something like this:

for(Enumeration e=request.getParameterNames(); e.hasMoreElements(); )
{
   String paramName = (String)e.nextElement();

   String[] values = request.getParameterValues(paramName);

   System.out.print("******** request params key=" + paramName
                    + ", value=");

   if(null == values || 0 == values.length)
       System.out.println("NULL");
   else
       System.out.println(java.util.Arrays.asList(values));
}

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFUNWX9CaO5/Lv0PARAhZdAJ9y49zX4qFU04yXJ6inwFjNEcavTgCfToMN
F/7EPPW4eMIPqn/cGyHZo98=
=Sh4W
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to