• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

getting null when using request.getParameter()

 
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have a form(fields having input type as "TEXT" and "FILE") in my jsp.when i submit this form the action goes to an underlying jsp.The forms has the attribute ENCTYPE set to "multipart/form-data".
Because of this when i retrieve parameters in the underlying jsp using request.getParameter()...i'm getting null.
The form fields are to be stored in database and the FILE field is to be uploaded using jspsmart package.
any help???
thanks in advance
sunil
 
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
there are apparently a few web servers that don't like the multipart/form-data.

Specifically, iPlanet does not have a properly written webconnector, so what happens is it tries to do a regular parse on multipart/form-data, doesn't get a result it expects, and when you try to use it, it gives you nulls. This is actually a known behaviour, buried in the documentation.

Perhaps your server does something similar.
 
author
Posts: 621
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, since multipart data is intended for sending large blocks of binary data, the browser formats the post differently. Instead of the normal name/value pairing in the request header, the data of put into delimited blocks after the header. The boundry marker ussually looks something like this,
boundry=---4j546i56hi5i76in549ri-------------------------
The server isn't expected to do anything with this since handling this data is a little tricky. It would be nice if Sun added a sub class of servlet that helped to parse multipart data but until that happens, check out the orielly multipart code from the Servlet Programming book for some ideas on handling this type of data. Better yet, if you're not uploading any files, don't use multipart encryption.
Sean
reply
    Bookmark Topic Watch Topic
  • New Topic