i am trying to get the complete parameter map from the request object and iterate over it. here is the sample code
output
its evident from the output that the value object is an instance of String
it prints nothing but as per the previous output it should have printed the values and if i remove instanceOf check it gives ClassCastException. is this the expected behavior or i am doing something wrong here ? | ||
add comment (requires an account with 50 reputation) |
| |||
|
The value is an array. If you're sure that the array is not empty, you should get the string value like this:
| |||
|
As the object which is returned is an array of strings as Harry Joy pointed out, you will have to use the
|
String
somewhere (try usingjava.lang.String
instead ofString
to find out)? 2. Are you using the exact same values when running the two pieces of code? 3. Try usingString.valueOf(value)
orvalue.toString()
and see what happens. Hope it helps. – The Nail Dec 5 '11 at 7:34