madhuri kunchala wrote:hi hari,
thanks for your reply..i tried what you suggested..but im getting the output as follows
output ---- 'DB1,5:DV1,8::::::' but i need as 'DB1,5:DV1,8:'
here is my modified code....im not able to trace why im getting ending so many 'colons' but i need is only one 'colon'
you told to use trim function may i know where to implement it...
in my jsp page....i had checkbox with corresponding textbox....here is my jsp page code...
i hope you got what im saying...can you help me out in this matter..waiting for the reply...
Rene Larsen wrote:Well - where in your modified code did you do what Hari suggested ??
- check for empty strings
- changed the for loop variable 'i' from 1 to 2
Hari haran the great wrote:Hi Rene,
In your code, there are two conditions that are checked for every time the loop runs. In that two conditions, one of them is not at all needed because the number of times that the loop is going to run, is dependent on the second condition which you have written in the if block. So I made it the loop condition, which removes unnecessary branching statement "if". Comparing your code and mine [I am telling for only educational purposes, not to prove that i am better], my code is optimized and performs better because, unnecessary branching statements are not present, and unnecessary conditions are removed.
What are the values of the String you get from request.getParameterValues(...) ??
hi subhash kumar,
i tried with hari's code...i m getting output as $..nothing im getting...here is my code which hari has suggested me...