문제

In my JSP I have an integer array where each integer has 19 digits. I am passing this array to a javascript function. Since javascript supports numbers in the range +/- 9007199254740992, the last three digits of all the integers in integer array is converted to zeroes.

For example in JSP - the integer array is [6918384653328004118 , 9016587993063058147] In javascript function, I receive this integer array as [6918384653328004000 , 9016587993063058000]

Please let me know how I can pass the complete 19 digit integer array to javascript function.

Thanks, Surabhi

도움이 되었습니까?

해결책

If you do not intend to use these integers for calculation, can you just pass to your Javascript as Strings and treat them as Strings in your JS code?

Instead of generating an array of numbers ([6918384653328004118 , 9016587993063058147]), change your JSP so it wraps your numbers in quotes (["6918384653328004118" , "9016587993063058147"]). Javascript interprets that as an array of Strings.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top