File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Open Source Projects and the fly likes [Resolved] Commons Fileupload problem with textarea Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Other Open Source Projects
Bookmark "[Resolved] Commons Fileupload problem with textarea" Watch "[Resolved] Commons Fileupload problem with textarea" New topic

[Resolved] Commons Fileupload problem with textarea

Florian Gutierrez

Joined: Apr 15, 2009
Posts: 4

First of all, I want to say, I've searched on google and on this forum how to solve my problem ; but I didn't find anything that could show me what the issue is caused by.
My problem is very simple: I have a form (in a JSP), that contains some fields. Within this form, I want to upload a file. So I use the commons FileUpload library. I put my fields value in a hasmap in order to access them easily.
This part works fine... except for one field : my textarea.
So I searched on the internet to know if textareas values are not handled by this library, but found nothing

All I've found is some piece of code that explains how to get the file.

Here is the how I map the fields and theirs values:

When I went into debug mode, I saw that the corresponding value of my textarea is empty.
So, I want to ask you: is there a known issue with this library and textarea ? Or did I do something wrong ? Or did I miss something that would explain that textarea should not be supported ? Finally, how can I get the value of this textarea ?

Thanks in advance

EDIT: Woops ! I just saw that I posted this message in the wrong place. i don't know how to apologise : I was searching on this forum about my problem, and started this thread from there.. Thought I was in the right place. I really am sorry. Anyone who can, please move this subject to the right place
Florian Gutierrez

Joined: Apr 15, 2009
Posts: 4
God ! how I hate those careless bugs ..

Well, I've found what was wrong: I got 2 fields with the same name .. And in my tests the second was always empty. So when I was settingthe values in the HashMap, the values was first set correctly, then re-written to an empty value.

I figured it out with this :

and saw that the field appears two times

Well, I'm sorry for creating the thread in the wrong place. And I'm sorry for the people who started to search what my problem was.
I'm going to edit the title of this thread to mark it as "Resolved"
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63858

Common mistake. Thanks for updating with the solution so others can benefit!

[Asking smart questions] [About Bear] [Books by Bear]
jQuery in Action, 3rd edition
subject: [Resolved] Commons Fileupload problem with textarea
It's not a secret anymore!