Win a copy of AWS Security this week in the Cloud/Virtualization forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

getting null when using request.getParameter()

Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • 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
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • 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.
Posts: 621
  • Mark post as helpful
  • send pies
  • 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,
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.
Self destruct mode activated. Instructions for deactivation encoded in this tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
    Bookmark Topic Watch Topic
  • New Topic