java numberformat exception

Posted on 2009-05-01
Last Modified: 2013-11-24
i have a billingdetailid as an Integer field.

Now this has no value when called from database so billingdetails.getbillingdetailid is null.

Now when i do
 String billingDetailId = (request.getParameter("billingDetailId"));
it throws the following error.

java.lang.NumberFormatException: For input string: "null"

Please tell  me how can i rectify it.

Question by:SunScreenCert
    LVL 37

    Expert Comment

    Can you show us the method getParameter() used in

    LVL 6

    Accepted Solution

    I guess you have something like Integer.parseInt(string_param) somewhere. This type of method requires a number as string_param and null is not. You need to fix the problem so the paramter is not null there either by checking that it is not null:
    if !(string_param == null){
        //do whatever necessary to handle null

    Or you could make sure that the DB doesn't return null

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
    Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
    Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
    Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now