I assume that it is supposed to append the integer to the end of the string, but I do not believe this assumption is correct. The following is the code:
num is an integer passed in from another method and Sic is a string. My error is Exeception: java.lang.NullPointerException. From my log, I discovered that the furthest it got was line 280. I have tried to cast num using String.valueOf() and I have also tried to cast "Sic" for the if statement. Once cast, code is set to the value of Sic with the number appended. Once I ran the program, this implementation is incorrect. So my question is, What does this do?
As you fix this please only do the string math once.
Joined: Jul 14, 2009
Thank you. I will do the error checking and the string math one time and post the results.
Joined: Jul 14, 2009
So I did the error checking and it did get rid of the exception, but that field in the form isn't supposed to be null. When it is, an error message comes up on the screen. But after the error checking, even when the field isn't empty, the error message shows up on the screen.
My job is revamping code from about 7 years ago, and we are in the process of taking scriptlets out of the jsps. The jsp that accompanies this servlet is scriptlet free, and now I am having trouble with this servlet. Before I took the scriptlets out, this portion of the program worked... But because we have upgraded WAS, the scriptlets must go and now this portion fails.
Could someone explain to me how this is happening? Before I took out the scriptlets, there was a value for request.getParameter("string" + int), but after the scriptlets are gone, no value for request.getParameter("string" + int). The same information is being entered on the screen as it was before.
shivendra tripathi wrote: I would recommend you to check the value of "num". I suspect scriplets are doing some processing on num.
How this be possible in a page with no scriptlets?
Joined: Aug 26, 2008
Since earlier he has scriplet in page which might be doing some processing so he was able to get the param value.
num = num+1;
request.getParameter(String + num);
now since he has removed the scriptlet so he is trying to find different param value which doesn't exist.