• Post Reply Bookmark Topic Watch Topic
  • New Topic

stringarray exception

 
subrahm puvvada
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String[] checkedValues=String request.getParameterValues("checkit");

the exception is comming as
[Ljava.lang.String;@1fb7cbb

what may be the problem
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by subrahm puvvada:
String[] checkedValues=String request.getParameterValues("checkit");


Shouldn't be that way. See the snippet below.

 
subrahm puvvada
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String[] checkedValues= request.getParameterValues("checkit");
i have placed like this also
but the exception is comming
 
Sravan Kumar
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getParameterValues(Srting name) returns a String[] that contains all the parameter values (for this name) that gets passed in the request.

The code that you have written retrieves the parameter values for "checkit". My guess is in your code, you have this:



This will print the address of the String[] onto the response stream and not the value of "checkit" as you expect.

SOLUTION:
1. Iterate through the String[] and print element by element to the response OutputStream / console.

2. Or, if "checkit" contains only one value, then use request.getParameter() in a String instead of request.getParameterValues() and print the String

NOTE: What gets printed is not an Exception as you have posted. It is the result of toString() (on ther String[] object) that you are tying to print.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!