2

Is there a way to get the tomcat default description of a HTTP error in a jsp page? I can get the Status code (404, 500, 505), like:

<%=response.getStatus() %>

but I didn't find how to get the description:see the printscreen

Have you any ideas?

Thank you for your help.

havana1962
  • 51
  • 1
  • 6
  • 2
    you have to look at this question, may help you out: http://stackoverflow.com/questions/1302072/how-can-i-get-the-http-status-code-out-of-a-servletresponse-in-a-servletfilter – mumair Nov 12 '15 at 10:47
  • 1
    I saw it, but it didn't help me. – havana1962 Nov 12 '15 at 11:13

1 Answers1

3

If someone is interested I found the answer on stackoverflow : Java library to map HTTP status code to description?

You will need to download the jar of Appache Commons HttpClient and import it to your jsp page:

<%@page import="org.apache.commons.httpclient.*"%>

And with the method getStatusText you can get the Http Error description: <%=HttpStatus.getStatusText(response.getStatus())%>.

Community
  • 1
  • 1
havana1962
  • 51
  • 1
  • 6