You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by temp temp <mi...@yahoo.com> on 2006/11/03 17:04:23 UTC
request.getParameterMap
I want all the parameters in ServletRequest object for this I am using the method request.getParameterMap(). It returns java.util.Map which contains request parameter name and its value.When I print out the Map I can read the key but I cannot read the value .
Here is the print of the Map
06/11/03 10:58:57 ************ request params key score1 , value [Ljava.lang.String;@13f348b
06/11/03 10:58:57 ************ request params key progname , value [Ljava.lang.String;@92997e
06/11/03 10:58:57 ************ request params key submit , value [Ljava.lang.String;@9b601d
06/11/03 10:58:57 ************ request params key numberPerPage , value [Ljava.lang.String;@c3362f
06/11/03 10:58:57 ************ request params key appNum , value [Ljava.lang.String;@1a5770
06/11/03 10:58:57 ************ request params key sortBy , value [Ljava.lang.String;@1628b8d
06/11/03 10:58:57 ************ request params key amount2 , value [Ljava.lang.String;@b80f1c
06/11/03 10:58:57 ************ request params key hasAward , value [Ljava.lang.String;@1e80f3a
06/11/03 10:58:57 ************ request params key score2 , value [Ljava.lang.String;@3fc47c
06/11/03 10:58:57 ************ request params key orgState , value [Ljava.lang.String;@7cb44d
06/11/03 10:58:57 ************ request params key amount1 , value [Ljava.lang.String;@1214626
06/11/03 10:58:57 ************ request params key orgName , value [Ljava.lang.String;@1849daf
How can I translate value [Ljava.lang.String;@1849daf to readable String?
Thanks & Regards
Miro
---------------------------------
We have the perfect Group for you. Check out the handy changes to Yahoo! Groups.
Re: request.getParameterMap
Posted by Niall Pemberton <ni...@gmail.com>.
On 11/3/06, temp temp <mi...@yahoo.com> wrote:
> I want all the parameters in ServletRequest object for this I am using the method request.getParameterMap(). It returns java.util.Map which contains request parameter name and its value.When I print out the Map I can read the key but I cannot read the value .
They are String arrays.
Niall
> Here is the print of the Map
> 06/11/03 10:58:57 ************ request params key score1 , value [Ljava.lang.String;@13f348b
> 06/11/03 10:58:57 ************ request params key progname , value [Ljava.lang.String;@92997e
> 06/11/03 10:58:57 ************ request params key submit , value [Ljava.lang.String;@9b601d
> 06/11/03 10:58:57 ************ request params key numberPerPage , value [Ljava.lang.String;@c3362f
> 06/11/03 10:58:57 ************ request params key appNum , value [Ljava.lang.String;@1a5770
> 06/11/03 10:58:57 ************ request params key sortBy , value [Ljava.lang.String;@1628b8d
> 06/11/03 10:58:57 ************ request params key amount2 , value [Ljava.lang.String;@b80f1c
> 06/11/03 10:58:57 ************ request params key hasAward , value [Ljava.lang.String;@1e80f3a
> 06/11/03 10:58:57 ************ request params key score2 , value [Ljava.lang.String;@3fc47c
> 06/11/03 10:58:57 ************ request params key orgState , value [Ljava.lang.String;@7cb44d
> 06/11/03 10:58:57 ************ request params key amount1 , value [Ljava.lang.String;@1214626
> 06/11/03 10:58:57 ************ request params key orgName , value [Ljava.lang.String;@1849daf
>
> How can I translate value [Ljava.lang.String;@1849daf to readable String?
> Thanks & Regards
> Miro
>
>
> ---------------------------------
> We have the perfect Group for you. Check out the handy changes to Yahoo! Groups.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: request.getParameterMap
Posted by Levan Dvalishvili <dv...@verticali.com>.
Thats Objects default toString() method that does that .
try casting .....out((String)value);
Levan Dvalishvili
Support Lead US
Verticali,Inc
(646) 736 - 6075
-----Original Message-----
From: temp temp [mailto:miroconnect@yahoo.com]
Sent: Friday, November 03, 2006 11:04 AM
To: user@struts.apache.org
Subject: request.getParameterMap
I want all the parameters in ServletRequest object for this I am using
the method request.getParameterMap(). It returns java.util.Map which
contains request parameter name and its value.When I print out the Map I
can read the key but I cannot read the value .
Here is the print of the Map
06/11/03 10:58:57 ************ request params key score1 , value
[Ljava.lang.String;@13f348b
06/11/03 10:58:57 ************ request params key progname ,
value [Ljava.lang.String;@92997e
06/11/03 10:58:57 ************ request params key submit , value
[Ljava.lang.String;@9b601d
06/11/03 10:58:57 ************ request params key numberPerPage ,
value [Ljava.lang.String;@c3362f
06/11/03 10:58:57 ************ request params key appNum , value
[Ljava.lang.String;@1a5770
06/11/03 10:58:57 ************ request params key sortBy , value
[Ljava.lang.String;@1628b8d
06/11/03 10:58:57 ************ request params key amount2 , value
[Ljava.lang.String;@b80f1c
06/11/03 10:58:57 ************ request params key hasAward ,
value [Ljava.lang.String;@1e80f3a
06/11/03 10:58:57 ************ request params key score2 , value
[Ljava.lang.String;@3fc47c
06/11/03 10:58:57 ************ request params key orgState ,
value [Ljava.lang.String;@7cb44d
06/11/03 10:58:57 ************ request params key amount1 , value
[Ljava.lang.String;@1214626
06/11/03 10:58:57 ************ request params key orgName , value
[Ljava.lang.String;@1849daf
How can I translate value [Ljava.lang.String;@1849daf to readable
String?
Thanks & Regards
Miro
---------------------------------
We have the perfect Group for you. Check out the handy changes to Yahoo!
Groups.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: request.getParameterMap
Posted by Mike Baroukh <mb...@cardiweb.com>.
I suppose this values are array of strings ...
temp temp a écrit :
> I want all the parameters in ServletRequest object for this I am using the method request.getParameterMap(). It returns java.util.Map which contains request parameter name and its value.When I print out the Map I can read the key but I cannot read the value .
>
> Here is the print of the Map
>
>
> 06/11/03 10:58:57 ************ request params key score1 , value [Ljava.lang.String;@13f348b
> 06/11/03 10:58:57 ************ request params key progname , value [Ljava.lang.String;@92997e
> 06/11/03 10:58:57 ************ request params key submit , value [Ljava.lang.String;@9b601d
> 06/11/03 10:58:57 ************ request params key numberPerPage , value [Ljava.lang.String;@c3362f
> 06/11/03 10:58:57 ************ request params key appNum , value [Ljava.lang.String;@1a5770
> 06/11/03 10:58:57 ************ request params key sortBy , value [Ljava.lang.String;@1628b8d
> 06/11/03 10:58:57 ************ request params key amount2 , value [Ljava.lang.String;@b80f1c
> 06/11/03 10:58:57 ************ request params key hasAward , value [Ljava.lang.String;@1e80f3a
> 06/11/03 10:58:57 ************ request params key score2 , value [Ljava.lang.String;@3fc47c
> 06/11/03 10:58:57 ************ request params key orgState , value [Ljava.lang.String;@7cb44d
> 06/11/03 10:58:57 ************ request params key amount1 , value [Ljava.lang.String;@1214626
> 06/11/03 10:58:57 ************ request params key orgName , value [Ljava.lang.String;@1849daf
>
> How can I translate value [Ljava.lang.String;@1849daf to readable String?
> Thanks & Regards
> Miro
>
>
> ---------------------------------
> We have the perfect Group for you. Check out the handy changes to Yahoo! Groups.
>
--
Mike Baroukh
---
Cardiweb - 31 Rue de Mogador Paris IXeme
06 63 57 27 22 - 01 53 21 82 63 - Jabber: mbaroukh@jabber.org
http://www.cardiweb.com
---
Re: request.getParameterMap
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Nitin,
Nitin M. Mandolkar wrote:
> 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.
Sorry... is there a question in there?
I definitely posted code that would convert your request parameters into
String values. You're right, I didn't use getParameterMap, but it's
because I thought it wasn't necessary.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFFVy+59CaO5/Lv0PARAi+KAKCdWsbEmlCrAy3mgFC1w/pQ/optLACgxFWm
mu90qsNIAM6uv0QKXZqlwGY=
=Le1u
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: request.getParameterMap
Posted by "Nitin M. Mandolkar" <ni...@gmail.com>.
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:chris@christopherschultz.net]
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:miroconnect@yahoo.com]
> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: request.getParameterMap
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Nitin,
> From: temp temp [mailto:miroconnect@yahoo.com]
> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: request.getParameterMap
Posted by "Nitin M. Mandolkar" <ni...@gmail.com>.
Cast it to String object.
Nitin
-----Original Message-----
From: temp temp [mailto:miroconnect@yahoo.com]
Sent: Friday, November 03, 2006 8:04 AM
To: user@struts.apache.org
Subject: request.getParameterMap
I want all the parameters in ServletRequest object for this I am
using the method request.getParameterMap(). It returns java.util.Map
which contains request parameter name and its value.When I print out
the Map I can read the key but I cannot read the value .
Here is the print of the Map
06/11/03 10:58:57 ************ request params key score1 ,
value [Ljava.lang.String;@13f348b
06/11/03 10:58:57 ************ request params key progname ,
value [Ljava.lang.String;@92997e
06/11/03 10:58:57 ************ request params key submit ,
value [Ljava.lang.String;@9b601d
06/11/03 10:58:57 ************ request params key
numberPerPage , value [Ljava.lang.String;@c3362f
06/11/03 10:58:57 ************ request params key appNum ,
value [Ljava.lang.String;@1a5770
06/11/03 10:58:57 ************ request params key sortBy ,
value [Ljava.lang.String;@1628b8d
06/11/03 10:58:57 ************ request params key amount2 ,
value [Ljava.lang.String;@b80f1c
06/11/03 10:58:57 ************ request params key hasAward ,
value [Ljava.lang.String;@1e80f3a
06/11/03 10:58:57 ************ request params key score2 ,
value [Ljava.lang.String;@3fc47c
06/11/03 10:58:57 ************ request params key orgState ,
value [Ljava.lang.String;@7cb44d
06/11/03 10:58:57 ************ request params key amount1 ,
value [Ljava.lang.String;@1214626
06/11/03 10:58:57 ************ request params key orgName ,
value [Ljava.lang.String;@1849daf
How can I translate value [Ljava.lang.String;@1849daf to
readable String?
Thanks & Regards
Miro
---------------------------------
We have the perfect Group for you. Check out the handy changes to Yahoo!
Groups.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org