When i try to run this code it rans well but in console it shows an NullPointerException always.Eventhough the variable contains some data it throws a exception.Please tell me why it occurs? Ofcourse itsn't interrupt the flow of the project, i dont want any such exceptions to be thrown.
Never try to be a hard-worker. Be a smart-worker.
To handle null values, you should not catch NullPointerException. It´s a RuntimeException, which usually indicate a fault in the code (thus, a fault of the developer). You should avoid RuntimeExceptions by simply coding the right way. To handle null values, you need to add a nullcheck.
To find out what request parameters actually are available, print the parameter map: