2
有没有办法在jsp页面中获取tomcat对HTTP错误的默认描述? 我可以得到状态代码(404,500,505),如:jsp get http错误描述
<%=response.getStatus() %>
,但我没有找到如何获得描述:see the printscreen
你有什么想法?
谢谢你的帮助。
有没有办法在jsp页面中获取tomcat对HTTP错误的默认描述? 我可以得到状态代码(404,500,505),如:jsp get http错误描述
<%=response.getStatus() %>
,但我没有找到如何获得描述:see the printscreen
你有什么想法?
谢谢你的帮助。
如果有人有兴趣,我发现在计算器的答案: Java library to map HTTP status code to description?
您将需要下载的Appache Commons HttpClient 的jar并将其导入到你的JSP页面:
<%@page import="org.apache.commons.httpclient.*"%>
并与方法getStatusText你可以得到Http Error的描述: <%=HttpStatus.getStatusText(response.getStatus())%>
。
你必须看看这个问题,可能会帮助你:http://stackoverflow.com/questions/1302072/how-can-i-get-the-http-status-code-out-of-a- servletresponse-in-a-servletfilter – mumair
我看到了,但它没有帮助我。 – havana1962