This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes NumberFormatException : null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "NumberFormatException : null" Watch "NumberFormatException : null" New topic
Author

NumberFormatException : null

Gaurav Wadhwani
Ranch Hand

Joined: Sep 21, 2010
Posts: 68
Please help
Im not able to find wheres the problem and how to resolve



The servlet is to upload 2 files and insert the data in the form.

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60740
    
  65

So what's the problem? What line it is on?

Here's some helpful hints:

  • Just posting a bunch of code and asking "what's wrong with it?" isn't an effective way to get help on an issue.
  • Always provide the exact error message, not your paraphrasing of it.


  • [Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
    Gaurav Wadhwani
    Ranch Hand

    Joined: Sep 21, 2010
    Posts: 68
    Problem is the exception generated...its on line 115





    Matthew Brown
    Bartender

    Joined: Apr 06, 2010
    Posts: 4338
        
        7

    It seems likely that one of the parameters you think is an integer isn't in fact an integer. If you want more than that you'll have to tell us where the error happens.

    Edit: ah, there you go. What's the value of the day parameter?
    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60740
        
      65

    Basic debugging step #1, what is the value returned by the call to getParameter()? That's something that should be checked long before you post the problem to a forum.
    Gaurav Wadhwani
    Ranch Hand

    Joined: Sep 21, 2010
    Posts: 68
    ok i checked....it returns null.

    the form has a element with name "day". Then why the problem?

    Bear Bibeault
    Author and ninkuma
    Marshal

    Joined: Jan 10, 2002
    Posts: 60740
        
      65

    Use a tool such as HttpFox for Firebug to see the HTTP request for the form submission. Is the request parameter there as you expect?
    Gaurav Wadhwani
    Ranch Hand

    Joined: Sep 21, 2010
    Posts: 68
    you are right...
    I tested using HttpFox, it doesnt return any value...



    and if you notice 2 rows below it, then those the images i want to be uploaded. Method turns into GET....thats strange
    Gaurav Wadhwani
    Ranch Hand

    Joined: Sep 21, 2010
    Posts: 68
    Ok i found the solution....

    Multipart/form is handled dependent on the API one uses. I used Apache's org.apache.commons.fileupload . for it this is the way to go...

    request.getParameters() wont work...


     
    It is sorta covered in the JavaRanch Style Guide.
     
    subject: NumberFormatException : null
     
    Similar Threads
    ResultSet Exhausted Error
    Trouble with "@" and spaces in mySQL
    html and servlet with jdbc
    image is not uploaded into the database
    Cache Problem in Jsp...