aspose file tools*
The moose likes Java in General and the fly likes problem in output format Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "problem in output format" Watch "problem in output format" New topic
Author

problem in output format

madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi hari,
are you busy...i had done the changes what you had suggested..
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
k...shall i post my question...in your mail
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
k...i'll post my problem in forum only...
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
any help regarding my code....im getting wrong output...
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

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.


Regards, Rene Larsen
Dropbox Invite
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
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

Joined: Oct 12, 2001
Posts: 1179

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

Joined: Mar 30, 2010
Posts: 350
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

Joined: Oct 12, 2001
Posts: 1179

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

Joined: Mar 30, 2010
Posts: 350
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

Joined: Mar 30, 2010
Posts: 350
any change in the code is required...
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

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

Joined: Mar 30, 2010
Posts: 350
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

Joined: Oct 12, 2001
Posts: 1179

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

Joined: Mar 30, 2010
Posts: 350
ok...thanks for the information you had given....
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: problem in output format