Soeren,


Michael> I just added two new exceptions to be thrown when the content
length or
Michael> maximum length is exceeded, they will be the root cause of the
Michael> ServletException thrown.  Is this good enough to be able to
elegantly handle
Michael> the problem for you?

>the new code is working well for me now.

>But  one  question I still have is where would I catch the post to big
>exeption?
>Is there an elegant way in struts to do it?

I would assume if you could somehow catch the ServletException that wraps
it, you could get the root cause and see if it's an instance of
org.apache.struts.upload.MaxLengthExceededException and go from there.
Could that work inside of a jsp error page? Like this:

<%@ page language="java" errorPage="true" %>

<%
        if (exception instanceof ServletException) {
                Exception rootException = ServletException.getRootCause();
                if (rootException instanceof MaxLengthExceededException) {
                        //do your thing here
                }
        }
%>

Reply via email to