Does form with enctype="multipart/form-data" cause problems accessing a hidden field

Posted by Ankur on Stack Overflow See other posts from Stack Overflow or by Ankur
Published on 2010-05-13T14:54:48Z Indexed on 2010/05/13 15:14 UTC
Read the original article Hit count: 406

Filed under:
|
|
|
|

I have created a hidden form element

<form name="UploadImage" enctype="multipart/form-data" method="post" action="UploadImage">
    <label>
        </label>
    <input name="imgUploadObjId" id="imgUploadObjId" value="52" type="hidden">

    //rest of the form here

</form>

And I am trying to get the value with this line in a servlet (as I have done before):

int objId = Integer.parseInt(request.getParameter("imgUploadObjId"));

But I get this (line 33 is the line above):

java.lang.NumberFormatException: null
java.lang.Integer.parseInt(Unknown Source) java.lang.Integer.parseInt(Unknown Source) web.objects.UploadImage.doPost(UploadImage.java:33) javax.servlet.http.HttpServlet.service(HttpServlet.java:637) javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Is there something different about a form with enctype="multipart/form-data"? Or can you see some other error.

© Stack Overflow or respective owner

Related posts about html

Related posts about form