Time for action – adding images to the product page
Let's add the image upload facility to our add products
page:
- Add a bean definition in our web application's context configuration file (
DispatcherServlet-context.xml
) forCommonsMultipartResolver
, as follows:<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"> <property name="maxUploadSize" value="10240000"/> </bean>
- Open
pom.xml
; you can findpom.xml
under the project root directory itself. - 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. - A Select Dependency window will appear; enter Group Id as
commons-fileupload
, Artifact Id ascommons-fileupload ...
Get Spring MVC Beginner’s Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.