Inserting null value

Discussions

Web tier: servlets, JSP, Web frameworks: Inserting null value

  1. Inserting null value (2 messages)

    Hi all,

    I hav a html form in which i will be entering a value. I am reading this value using request.getParameter(..) in a jsp and trying to insert that into database. The corresponding column in database is of number type. When i dont enter any value in the form and submit it request.getParameter(..) is returning me a blank string. What if i wanted to insert a null into the database....?

    I dont want to make to query static by checking the return value.

    What i want to know is ...Is there any why by which it should automatically insert the value if present else insert null.( but no zero )

    thanks
    Nagendra

    Threaded Messages (2)

  2. Inserting null value[ Go to top ]

    This is a very difficult problem that may take years to figure out. Good luck.
  3. Inserting null value[ Go to top ]

    convert the null value into empty string

    use this method

    public String nullReplace(String inputfield)
    {
    if(inputfield == null)
    {
    inputfield="";
    }
    return inputfield;
    }
    and try inserting it.

    Good luck.