Announcement Announcement Module
Collapse
No announcement yet.
Page cannot be displayed while trying to upload a file Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Page cannot be displayed while trying to upload a file

    In FileUpload, I defined the maxUploadSize as following in xml:

    <bean id="multipartResolver"
    class="org.springframework.web.multipart.commons.C ommonsMultipartResolver">

    <!-- one of the properties available; the maximum file size in bytes -->
    <property name="maxUploadSize">
    <value>100000</value>
    </property>
    </bean>

    When I upload a file which is larger than the maxUploadSize, it goes to 'Page cannot be displayed' page with following errors in the log.

    [org.springframework.web.servlet.DispatcherServlet] - <Handler execution resulted in exception - forwarding to resolved error view>
    org.springframework.web.multipart.MaxUploadSizeExc eededException: Maximum upload size of 100000 bytes exceeded
    at org.springframework.web.multipart.commons.CommonsM ultipartResolver.resolveMultipart(CommonsMultipart Resolver.java:247)

    Even though I defined exceptionResolver, it doesn't seem to hit there before the error shows up.

    <bean id="exceptionResolver" class="org.springframework.web.servlet.handler.Sim pleMappingExceptionResolver">
    <property name="exceptionMappings">
    <props>
    <prop key="java.lang.Exception">WEB-INF/60/jsp/error.jsp</prop>
    </props>
    </property>
    </bean>

    How do we handle this exception ?

    Any helps are appreciated.
Working...
X