Hi Jeromy, Thanks for the help. I tried to do the same thing with an xml file. Instead of using failed.jsp, I returned an xml file failed.xml with some hard coded error message and error code.
What if the file upload interceptor returned "input" for some other reason? I would be returning the error code and message which says the file is too large. How would I create the error message and code dynamically depending on the actual error? Rajeev On Wed, 2008-04-09 at 22:22 +1000, Jeromy Evans wrote: > Rajeev Sharma wrote: > > > > When I try to upload a file which is bigger then the max allowed size, > > the file upload interceptor returns "input" and the control does not > > come to the execute method of my action class. In this case I can > > redirect the result to some JSP, to some other action etc, but how do I > > return a xml response with the error description and some error code. > > > > > Hi Rajeev, > > It sounds like you just want an action to return an XML result (for an > "input" result). > A very simple way to do that is return a JSP with contentType="text/xml". > > in struts.xml: > <result name="input">failed.jsp</result> > in the failed.jsp: > > <%@ page contentType="text/xml;charset=ISO-8859-1" %> > <?xml version="1.0" encoding="ISO-8859-1"?> > <message>Too big!</message> > > > You can use properties in your XML as you would with a JSP result. > > There's also an XSLT result type available or you could use a Bean->XML > serializer like XStream. > > Hope that helps, > Jeromy Evans > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]