Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem in output format

 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi hari,
are you busy...i had done the changes what you had suggested..
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
k...shall i post my question...in your mail
 
Rob Spoor
Sheriff
Pie
Posts: 20492
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please don't: UseTheForumNotEmail. If you start emailing Hari then others will not see any updates. If Hari wishes to leave that's fine, and we cannot prevent you from contacting him, but as said, we won't be able to provide any help anymore.
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
k...i'll post my problem in forum only...
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any help regarding my code....im getting wrong output...
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What input do you get in


Try use a System.out or log what negtveBalDebit[] looks like before you go into the foo loop - and then post it here. Otherwise we can only guess what YOU are getting as input.
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i had checked using 'System.out.println'..in String negtveBalDebit[] = request.getParameterValues("negtveBalDebit"); i m passing values from form...that means it takes checkbox and corresponding textbox values....it is taking for 2 check boxes i had 9 checkboxes...it is not taking what ever value i had taken....
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You wrote in one of your previous posts that you are getting F,5:M,4:$ but it should have been F,5:M,4,R_1_L,8:$

Which value is from the check box, and which one from the text field ??

I'm just guessing now...

F, and M, is from the check box and 5 and 4,R_1_L,8 is from the text field - or are they ??

If I try to emulate your input I'm getting the output I expect - but again, from the sample above what is what ??
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi good morning,
what you are expecting 'Rene' is right...my check box values are 'F,','A,','R_1_D' and so on......in textbox it takes numbers that should be entered by the user....if i m selecting alterenate checkboxes and corresponding textboxes im getting the output as F,5:M,4:$ instead of F,5:M,4:R_1_L,8:$ here is my code...
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With a String Array like this:

I'm getting this output:
F,5:M,4:R_1_L,8:$

Therefore I ask you again - what input do you get when you submit your form - do you get it like it should be (like my String Array) ??

You can test your code like I do - with just to emulate the input, and then a main method.
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Rene,
i got what you suggested..according to you if i did means it'll come...i need to get the values from form i.e., the check boxes and the corresponding text boxes..some times i'll select 1 or 2 or more than that i.e.,
1) select only one checkbox and corresponding textbox
2) select two checkboxes and corresponding textboxes i.e., continuously
2) select two or more checkboxes and corresponding textboxes i.e., alternatively

here is my jsp form

here is my code


im facing problem for the above mentioned point (3)....can you once check my code and provide me the solution.

thanks,
madhu.

 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
any change in the code is required...
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The String Array you are getting when submitting the form - doesn't have the structure that you expect...

e.g. if you look at the array I used, you'll see that there are pairs of elements:

but the array you get is e.g. like this - not in pairs:

therefore you need to use another for loop logic.

e.g. like this:
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Rene,
thanks a lot its working....i had doubt that you had used

why you had mentioned "" in the array...can you tell me...
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
madhuri kunchala wrote:hi Rene,
thanks a lot its working....i had doubt that you had used

why you had mentioned "" in the array...can you tell me...

That is the way the submitted array looks like - or should look like.

When you submit all elements are submitted - but not in a useful order (the empty elements are not submitted in pairs, like elements with data are).
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok...thanks for the information you had given....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic