Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7739959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:39:12+00:00 2026-06-01T08:39:12+00:00

I got a classic multipart form with spring mvc 3 which works fine :

  • 0

I got a classic multipart form with spring mvc 3 which works fine : I can upload a file to a controller with 2 parameters ( name and description).
My controller get the MultipartFile file and parameters, and put in database with DAO classes.

My Goal : just add to my form a progress bar while uploading the file !

Can anyone help me by telling me different steps to do.
I prefer do it with DWR if possible to expose the ProgressListener method.
(implement a ProgressListener for for MultipartResolver ,javascript to add to my form)

Any help Would Be Appreciate!

Here is my form : ( ajoutDocumentRapport.jsp)

<form:form method="post" action="save.html" commandName="documentFormBean" enctype="multipart/form-data">
<input type="hidden" name="depot" value="${depot.id}"/>
<table>
<tr>
    <td><form:label path="name">Name of file</form:label></td>
    <td><form:input path="name" /></td> 
    <td><form:errors path="name" cssClass="error"/></td>
</tr>
<tr>
    <td><form:label path="description">Description of file</form:label></td>
    <td><form:textarea path="description" /></td>
    <td><form:errors path="description" cssClass="error"/></td>
</tr>
<tr>
    <td><form:label path="content">Document</form:label></td>
    <td><input type="file" name="file" id="file"></input></td>
</tr>
<tr>
    <td colspan="2">
        <input type="submit" value="add Document."/>
    </td>
</tr>
</table>    
</form:form>

And here is my controller :

@RequestMapping(value = "/save", method = RequestMethod.POST)
    public ModelAndView save(HttpServletRequest request,
        @Valid DocumentFormBean documentFormBean,BindingResult result,
        @RequestParam("file") MultipartFile file) {
    Map<String,Object> map = new HashMap<String, Object>();

    map.put("documentFormBean", new DocumentFormBean());
    map.put("documentList",documentDao.findAllForaDepot(Long.parseLong((String) request.getParameter("depot"))));
    map.put("depot", depotDao.find(Long.parseLong((String) request.getParameter("depot"))));

    if (result.hasErrors()) {
        map.put("errors", result);
        return new ModelAndView("ajoutDocumentsRapport", map);
    } else{

    try {
        Blob blob = Hibernate.createBlob(file.getInputStream());
        Document newDocument = new Document();
        newDocument.setTitle(documentFormBean.getName());
        newDocument.setDescription(documentFormBean.getDescription());
        newDocument.setFilename(documentFormBean.getName());
        newDocument.setContentType(file.getContentType());
        newDocument.setFilename(file.getOriginalFilename());
        newDocument.setContent(blob);
        newDocument.setDepot(depotDao.find(Long.parseLong((String) request.getParameter("depot"))));
        documentDao.save(newDocument);
        map.put("documentList",     documentDao.findAllForaDepot(Long.parseLong((String) request.getParameter("depot"))));
        } catch (IOException e) {
        e.printStackTrace();
    }

    return new ModelAndView("ajoutDocumentsRapport",map);
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:39:14+00:00Added an answer on June 1, 2026 at 8:39 am

    Check this solution that I use:
    Use Spring MVC 3.1 and JQuery to make it work

    http://abambenjamin.blogspot.mx/2012/04/ajax-jquery-html5-progressbar-spring.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

on the server side, I've got these: ASPX: <form id=form1 runat=server enctype=multipart/form-data> <input type=file
So I've got our legacy app which is classic asp and I've got a
I've got an ASP.net file, and I'm trying to include dynamic code which was
I'm trying to port a classic ASP.NET MVC view to Razor and got stuck
I've got a 'classic' table which has table heads with field names in it:
We've got a classic ASP application that is putting out some very large reports,
I've got an old classic ASP site that connects to a local sql server
In Classic ASP, how do you detect on that the page got control via
I've got the unpleasurable task of working on a Classic ASP site (VBSCRIPT) and
I recently got bored and fired up my old Mac OS Classic emulator, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.