struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike J. M." <>
Subject Struts, Interceptor error message customization
Date Wed, 30 Jan 2008 18:51:29 GMT

So I am currently using Struts, including an action that has a fileUpload
Interceptor that checks for files that are too large and certain allowable
file types. Right now if either of these conditions are met, the system will
throw a generic HTTP 500 error up. What I am wondering is how to customize

in the docs:

i found these messages that i can supposedly customize. however, the doc
does not specify WHERE i am supposed to put these error messages at, and
furthermore, after looking at the source code for FileUploadInterceptor, I
found that these messages are printed to the log file, and it doesn't look
like it prints to the actual HTML.

* struts.messages.error.uploading - a general error that occurs when the
file could not be uploaded

* struts.messages.error.file.too.large - occurs when the uploaded file is
too large

* struts.messages.error.content.type.not.allowed - occurs when the uploaded
file does not match the expected content types specified

The doc says that these error messages originate from I'm guessing that's in the struts.jar itself
because I don't see it anywhere else, so am I supposed to modify that
directly? I'm a little bit iffy about doing that.

So, in a nutshell, how do I catch an Interceptor error and make it redirect
to a nice page instead of the generic HTTP 500 page? Actually, what would be
better is to redirect to an action while passing into it a parameter
"message" that will contain error messages. Then, in the JSP i want to do
<s:property ...> to grab that message.

thank you!

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message