[英]500 Error: Custom JSP page with Google App Engine
I want to provide users a custom JSP page to deal with the error 500. 我想为用户提供一个自定义JSP页面来处理错误500。
So far i tried the normal configuration in web.xml
到目前为止,我尝试在
web.xml
进行常规配置
<error-page>
<description>Uncaught exception</description>
<error-code>500</error-code>
<location>/error500.jsp</location>
</error-page>
Which is not working. 这不起作用。
And I also i tried this configuration by Google App Engine: 我也尝试通过Google App Engine进行以下配置:
https://developers.google.com/appengine/docs/java/config/appconfig#Custom_Error_Responses https://developers.google.com/appengine/docs/java/config/appconfig#Custom_Error_Responses
<static-error-handlers>
<handler file="/error500.jsp" />
</static-error-handlers>
I don't know which ones to use and I didn't manage to make any working. 我不知道该使用哪个,也无法正常工作。
I defined the error500.jsp as a servlet with an url pattern and it's now working with the config in web.xml. 我将error500.jsp定义为具有url模式的servlet,并且现在可以与web.xml中的配置一起使用。
But a direct access to error500.jsp get me a 404. So there is a problem but there is a work around. 但是直接访问error500.jsp会得到404。所以有问题,但是可以解决。
<servlet>
<servlet-name>error500</servlet-name>
<jsp-file>/WEB-INF/jsp/error500.jsp</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>error500</servlet-name>
<url-pattern>/error500</url-pattern>
</servlet-mapping>
<error-page>
<error-code>500</error-code>
<location>/error500</location>
</error-page>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.