0

I have several input type="text" with the same name.

<input type="text" name="fieldname">

<input type="text" name="fieldname">

<input type="text" name="fieldname">

Im trying to get the values inside those text fields. They are in a form used to upload images, that's why im using Collection <Part>

Inside this loops, how can i get the values of those text fields? I missed a part of code

 for (Part part: mhyCollectionParts) {           
             String filename = mhyCollectionParts.getName();             
             if(filename.equalsIgnoreCase("fieldname")){
                 //then...??????                     
             }               
         }
MDP
  • 4,177
  • 21
  • 63
  • 119

1 Answers1

1

If you are using Servlet 3.0 then you should be able to use
String fieldnameValues = request.getParameterValues("fieldname"); you don't need to use to Part to get values of your form field, but if you are using servlet < 3.0 you need to look at this answer. <web-app ... version="xxx"> tag in your web.xml will give you details of servlet api you are using.

Community
  • 1
  • 1
Yogesh
  • 4,546
  • 2
  • 32
  • 41