Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Passing Two Dimensional Array through Ajax to Java(Action) in Struts

 
Chitta Ranjan Mishra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I have already tried with some code successfully but it is of single value of true false type('Y'/'N'), but with the following code



just vanishes the field stating the following tomcat log error.
>

next problem is that when I try to assign some value like "Objective Numeric Answer", each word is taken for each txtArrOuter[k] as above.
If I try to assign value like "ObjectiveNumericAnswer" single word, it takes the whole word and repeats just three times and gives the error as above.
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your query is incorrect. Assuming the encoding works, you'll end up with something like this value for query:
In other words, you're missing the & between the parameters.
 
Chitta Ranjan Mishra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank's I have lost in vain all my valuable times without rectifying it. I will come back after trying you.
Thank's again.
 
Chitta Ranjan Mishra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have missed the ampersand in the posting not in My code.
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, it would help if you PostRealCode.
Can you show the query string as it is both sent and received?
 
Chitta Ranjan Mishra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
>
 
Chitta Ranjan Mishra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alert came as in

log as in tomcat from action class.
 
Rob Spoor
Sheriff
Pie
Posts: 20546
57
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chitta Ranjan Mishra wrote:ON_getHdnObjectiveNumericalIdArr()[1][1]: 0java.lang.ArrayIndexOutOfBoundsException: 1

OK, so the problem is in getHdnObjectiveNumericalIdArr. That makes me believe the problem lies in the handling of hdnObjectiveNumericalIdArr. So I check that part of your query:
In line 2 I see hdnObjectiveNumericalIdArr with value 0%2C0txtObjectiveNumerical=MultiChoiceAnswer. In line 4 I again see hdnObjectiveNumericalIdArr, this time with value 0%2C0. I think you've made a little mistake here.
 
Chitta Ranjan Mishra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
the first thing is I don't want to put any default value. But if I do not put any value in to it as in code bellow and marked in comments as"//value put here unnecessarily", then the ArrayIndexOutOfBoundsException comes for all the values in a whole.


The values "0%2C0" are taken from no where in the block bellow the commented line as "//else if(gblQueCat == "ON")" (from the prepareUrl() method of the whole js code). Except for the case all other blocks where no such error occurs. So the changed format in that block is because of this error.
>
 
Chitta Ranjan Mishra
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot I have got the error. The variable defined to assigned default is same as array variable.

BUT

I am still confused Can I use the code without using any default value?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic