Java Reference
In-Depth Information
Figure 13.3: Page shown for an invalid path
Download email_29/web/WEB-INF/jsp/not_found.jsp
<fmt:message var="title" key="exception.title"/>
<s:layout-render name="/WEB-INF/jsp/common/layout_main.jsp"
title="${title}">
<s:layout-component name="body">
<p style="color: red">
<fmt:message key="exception.not_found.message"/>
</p>
<s:link href="/">
<fmt:message key="exception.startOver"/>
</s:link>
</s:layout-component>
</s:layout-render>
Now, when the user enters /Admin.action , the page in Figure 13.3 will
appear.
At this point you might be wondering, why return an ErrorResolution with
the 404 code and configure web.xml to display not_found.jsp , instead of
just returning a ForwardResolution to not_found.jsp ? The answer is that
we now handle all invalid URLs, not just the ones go through Stripes.
No matter whether the user enters /Admin.action or /something.else , the
not_found.jsp page will be displayed.
As a final example of how we can use specific exception handling to
make our webmail application “smarter,” let's catch the exception that
is thrown when the user is composing a message and uploads an at-
tachment that exceeds the file size limit. We saw on page 199 that
the default maximum file upload size is 10MB. If the user uploads
a larger total size, Stripes throws a FileUploadLimitExceededException ,
which includes the maximum and posted sizes. We can recover from
this exception and go back to the message compose page, sending the
size information as parameters.
 
 
Search WWH ::




Custom Search