I know we can get exception using xhr.responseText
, but in my APP, the responseText
display as exception description amended by Tomcat. please refer to below image, is there anyone can tell me how can I control the content of responseText
or how to handle custom message(may be in a better way). I need a title and content in the response as I can display them in dialog of Jquery UI. BTW, I throw a general exception just like throw new Exception("some error happens");
You can define custom error message in your web.xml
like this -
<error-page>
<error-code>404</error-code>
<location>/error.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/Error.jsp</location>
</error-page>
You can have any text in your error.jsp page, that text will be sent to client on respective error
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.