• Post Reply Bookmark Topic Watch Topic
  • New Topic

request.getParameterValues()  RSS feed

Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
i am adding array to the request(like name,array)
then i am getting that array in my action class
(like request.getParameterValues())
but when i use array.length in action class it is displaying 1 as length

when i use request.getParameterNames() , it is displaying all values of array
but i am unable to process that array

my scenario is like this(please help me it's urgent)

i am setting request like this(of course i am using flex for front end forget about flex)

service4.request={ fieldIdArr:fieldId, fieldNameArr:fieldName, tabIdArr:tabId,
displayedInSectionArr isplayedInSection, fieldOrderArr:fieldOrder}

like (name:array) pair

then i am getting these arrays in my action class using

String[] fieldId = request.getParameterValues("fieldIdArr");
String[] fieldName = request.getParameterValues("fieldNameArr");
String[] tabId = request.getParameterValues("tabIdArr");
String[] displayedInSectionrequest.getParameterValues("displayedInSectionArr");
String[] fieldOrder = request.getParameterValues("fieldOrderArr");

it is storing fine in local string arrays
but when i process these arrays getting numberformati exception

and length is displying 1

when i use this code

Enumeration en=request.getParameterNames();
String str=en.nextElement().toString();
System.out.println("parameter name-->"+str);
System.out.println("parameter value-->"+request.getParameter(str));
in my action class displaying

parameter name-->fieldNameArr
parameter value-->Group,Company Name,Business Domain,Status,Licensee Status,Address1,City,Phone1,Zip,State,Time Zone,Country,Licensee Products,Comments,Territory
parameter name-->fieldOrderArr
parameter value-->14,15,16,17,18,19,21,22,24,26,27,28333,2933333,30,31
parameter name-->tabIdArr
parameter value-->3,3,3,3,3,3,3,3,3,3,3,3,3,3,3
parameter name-->displayedInSectionArr
parameter value-->,,,,vijay,vvvv,,vvvvvvvvvvvv,,,,vvvvvvv,,vijayggggggggggg,
parameter name-->fieldIdArr
parameter value-->50,51,52,53,54,55,57,58,60,62,63,64,65,66,67

of course i am setting this data in flex part
up to i am sending request ok..
but when i am processing arrays what i got it is showing numberformat exception

please how can i proceed for this
help me

thanks in advance
Ranch Hand
Posts: 146
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Vijay.

Tried to understand your problem. What kind of processing are you doing on your arrays? NumberFormatException could be coming if you are trying to parse your parameter values, since most values are strings which are non-parsable.

This is the only problem I can understand. Otherwise if you have ensured that values are getting stored properly in your arrays, there should not be any issues.

It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!