Announcement Announcement Module
No announcement yet.
Multipart using form library ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multipart using form library ?

    Hi ,

    I have a form which has been created using spring's form tag library and I want to add the functionality to add multiple images in that form. I didn't find any form:multipart or form:file tags, how can I do this without rewriting the entire form ?

    Thnx in advance!

  • #2
    Ok.. so I got the problem fixed and got a few concepts cleared as well in the process.

    1. I didn't need a form:tag for multipart files which looks obvious now as its not a form element I could directly use <input type="file" name="file"> and it will upload the file.

    I could access the file from the request by typecasting it to MultipartHttpServletRequest, so I didn't need to bind it to the command object.

    But uploading several files was still a problem as they all had same name file(because of cloning of nodes in javascript that I was using) and that used to throw exception in CommonsMultipartResolver for its base class method parseFileItems so I extended the CommonsMultipartResolver and overrode this method to accept inputs with same names(not of files but of inputs).

    Hope it helps some other newbie like me.