I am trying to use spring mvc to build web app.
Before I was using
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>
But now, because i need to upload files also, i have to change to
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize" value="1000000"/>
</bean>
This multipartResolver doesn’t have attributes like prefix.
If I need to use multipartResolver, where can I set the prefix and suffix?
Please give me suggestions, thank you!!!
The properties “prefix” and “suffix” are properties specific for the InternalResourceViewResolver. There are no properties on the CommonsMultipartResolver for this.
You need those properties to advise the InternalResourceViewResolver to tell it where to find jsp files (for example, if you return a string of “foo”, it will resolve with the “{prefix}foo{suffix}”, which is “/WEB-INF/jsp/foo.jsp”).
There is no need to define a prefix and suffix for the CommonsMultipartResolver. Per the comments in source code, the properties that CommonsMultipartResolver can use are “maxUploadSize”, “maxInMemorySize”, and “defaultEncoding”.