O'Reilly logo

Spring MVC Beginner’s Guide by Amuthan G

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – adding images to the product page

Let's add the image upload facility to our add products page:

  1. Add a bean definition in our web application's context configuration file (DispatcherServlet-context.xml) for CommonsMultipartResolver, as follows:
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
      <property name="maxUploadSize" value="10240000"/>
    </bean>
  2. Open pom.xml; you can find pom.xml under the project root directory itself.
  3. You will be able to see some tabs at the bottom of the pom.xml file. Select the Dependencies tab and click on the Add button of the Dependencies section.
  4. A Select Dependency window will appear; enter Group Id as commons-fileupload, Artifact Id as commons-fileupload ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required