一、错误页面的配置
1 添加错误页面,命名为err.jsp
2 将err.jsp的page指令设置为isError=“true”
3 在web.xml配置文件中配置错误页
4 <error-page>
<error-code>404</error-code>
<location>err.jsp</location>
</error-page>
5 在err.jsp中使用内置对象Exception来显示错误描述
二、 其他
1 开发环境的WebContent是运行环境的上下文,即${pageContent.request.contextPath}
2 项目名称与上下文路径默认一致
3 jsp中获取上下文:${pageContent.request.contextPath}
4 代码部分获取上下文:request.getContentPath()
1 添加错误页面,命名为err.jsp
2 将err.jsp的page指令设置为isError=“true”
3 在web.xml配置文件中配置错误页
4 <error-page>
<error-code>404</error-code>
<location>err.jsp</location>
</error-page>
5 在err.jsp中使用内置对象Exception来显示错误描述
二、 其他
1 开发环境的WebContent是运行环境的上下文,即${pageContent.request.contextPath}
2 项目名称与上下文路径默认一致
3 jsp中获取上下文:${pageContent.request.contextPath}
4 代码部分获取上下文:request.getContentPath()