JSP 中的 Error Page

spring-boot jsp whitelabel error page问题解决 欢迎使用Markdown编辑器写博客本Markdown编辑器使用StackEdit修改而来,用它写博客,将会带来全新的体验哦: Markdown和扩展Markdown简洁的语法 代码块高亮 图片链接和图片上传 LaTex数学公式 UML序列图和流程图 离线写博客 导入导出Markdown文件 丰富的快捷键 快捷键 加粗 Ctrl + B 斜体 Ctrl + I 引用 Ctrl 阅读详情

在 web.xml 中配置

<error-page>
    <error-code>404</error-code>
    <location>/WEB-INF/pages/error/404.jsp</location>
</error-page>
<error-page>
    <error-code>500</error-code>
    <location>/WEB-INF/pages/error/500.jsp</location>
</error-page>

有两个要点:

  • 把 jsp 放在 WEB-INF 中可以使其不能直接被访问。
  • 可以用 error-code 或者 exception type 来找示错误信息。

书写 error page

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page isErrorPage="true" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>后台错误</title>

<link rel="stylesheet" href="static/Endless1.5.1/bootstrap/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h3><a href="/BC3/"><img alt="真是抱歉!" src="static/img/sorry.png" style="width:80px;"></a><span class="label label-default">非常抱歉,后台出错了!点我返回...</span> </h3>

<br>
<table class="table">
    <tr>
        <td width="20%"><b>错误:</b></td>
        <td>${pageContext.exception}</td>
    </tr>
    <tr>
        <td><b>URI:</b></td>
        <td>${pageContext.errorData.requestURI}</td>
    </tr>
    <tr>
        <td><b>状态代码:</b></td>
        <td>${pageContext.errorData.statusCode}</td>
    </tr>
    <tr>
        <td><b>错误追溯:</b></td>
        <td>
            <c:forEach var="trace" items="${pageContext.exception.stackTrace}">
                <p>${trace}</p>
            </c:forEach>
        </td>
    </tr>
</table>
</div>
</body>
</html>
JSP errorPage设置方法 1.设置errorPage:errorPage.jsp 代码如下: <%@page isErrorPage=”true”%> <html> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″> <title>JSP Page</title> </head> <body> Error~! <%=exception.getMessage()%> </body> </html> 2.应用 代码如下: <%@page info=”Bad page”%> <%@page errorPage=”error 立即下载

相关推荐

EDF Browser使用说明和技巧

edf browser使用说明和一些小技巧

Erhu_666的博客 8378

JSP page指令errorPage属性起什么作用呢?

JSP page指令errorPage属性的功能简介说明

qq_25073223的博客 1915

DGX Spark上PyTorch GPU环境配置实战:CUDA 13.0与ARM架构全流程

在深度学习中,CUDA作为GPU加速计算的底层基础,其版本与深度学习框架(如PyTorch)的匹配直接影响模型训练的效率与稳定性。GPU环境配置不仅涉及驱动、CUDA工具链与框架运行时的协同,还依赖于硬件架构与预构建包的兼容性。在AI开发机Ubuntu系统上,正确对齐CUDA版本、计算能力架构及安装源,是避免环境故障、发挥硬件算力的关键。无论是面向个人AI超算还是通用GPU服务器,掌握版本对齐、路径隔离与验证方法,都能大幅提升开发效率。本文以DGX Spark为例,详解从环境摸底到PyTorch GPU版本

weixin_29483277的博客 228

JSP中errorPage无法跳转的解决办法

jsp编译指令page有errorPage和isErrorPage这两个属性,可以实现

如晦的专栏 9945

实例讲解Simulink应用层开发CAN报文解包及CAN信号设置方法

本文通过讲解MCU CAN解包模块的模块设置、输入输出信号的设置及仿真测试验证,说明了CAN解包模块的设置方法、CAN解包模块输入输出信号的设置方法以及CAN解包模块的仿真测试及修正方法。在模型搭建过程中,建议养成一种搭建完成仿真测试验证的习惯,在模块阶段发现错误,解决错误,避免在后期模块集成之后报出大量错误,增加解决错误的工作量和难度。希望通过本文的介绍能给相关技术人员带来一些参考和帮助。

qq_43011586的博客 5692

Oracle 11g R2 RAC 到单实例 Data Guard 搭建(RMAN备份方式)

Oracle RAC集群到单机的dataguard搭建过程

驰兔的博客 1729

jsp errorPage指令,错误页面的处理

errorPage指定若当前页面出现错误的实际响应页面是什么。其中 / 表示的是当前 web 应用的根目录。 语法 : &lt;%@ page errorPage="/error.jsp" %&gt; 在响应error.jsp 时,jsp引擎使用的是请求转发的方式。 isErrorPage 指定当前页面是否为错误处理页面,可以说明当期页面是否可以使用 exception 隐藏属性。...

蓝尊宝的博客 9161

串口调试神器诞生记:我是如何用Cursor+AI自动生成C#上位机的(含VSCode插件清单)

本文详细介绍了如何利用Cursor和AI技术快速开发C#上位机程序,实现高效的串口通讯调试。从开发环境搭建到代码自动生成,再到性能优化和功能增强,全面展示了AI辅助开发在串口调试中的实际应用和显著效率提升。

weixin_28340315的博客 312

JSP中errorPage的问题

           当在JSP的page指令中设置errorPage="url"就可以设置处理异常事件的JSP文件。如可以这样写:                           这样的话,当页面中出现异常的时候,就会自动跳转到错误处理页面。但是要注意,           只有当正常打开页面,然后在页面中出现异常的时候才会跳转到错误处理页面,如果页面本身有语法错误而出现了编译错

岁月无痕(veizz)的学习记录 1557

ADS 2024实战:手把手教你搞定2.3-3.5GHz宽带Doherty功放仿真与版图(附源文件)

本文详细解析了在ADS 2024环境中实现2.3-3.5GHz宽带Doherty功放的全流程设计,包括仿真与版图实现。从软件环境搭建、器件模型导入到核心电路设计、匹配网络优化,再到系统集成与版图生成,提供了实战技巧和关键参数设置。特别针对5G通信和卫星应用中的高效率需求,展示了如何通过ADS 2024的新功能提升设计效率。

weixin_42639246的博客 466

热力学仿真软件:ANSYS CFX_(15).旋转机械仿真

创建旋转域在中选择需要设置为旋转域的区域。选择选项。设置旋转速度在设置中,指定旋转速度(单位为弧度/秒)。也可以选择选项,并输入具体值。设置旋转轴在设置中,指定旋转轴的方向和位置。通常旋转轴的方向可以使用单位向量来表示,例如[0, 0, 1]表示沿Z轴旋转。旋转轴的位置可以通过指定一个点的坐标来确定,例如[0, 0, 0]表示旋转轴通过原点。旋转机械的仿真在ANSYS CFX中是一个复杂但重要的过程。

kkchenjj的博客 1167

spring boot 使用jsp遇到的Whitelabel Error Page

   刚开始学习springboot ,虽然springboot官方不推荐使用jsp,但还是想从熟悉的jsp入手。。。   按照网上教程    pom 加依赖、application.properti配置文件加入jsp支持、在main目录下创建webapp/WEB-INF/jsp、编写controller。如下但是访问总是报 Whitelabel Error Page后面论坛找到原因 pom文件t...

xx_star1204的博客 2067

掌握C++新特性中智能指针的综合指南

本文是一篇关于C++中智能指针的综合指南,旨在深入探讨现代内存管理的核心概念和技术。智能指针是C++中一种强大的工具,可以帮助开发人员更安全、高效地管理内存资源。通过详细解析各种类型的智能指针,包括unique_ptr、shared_ptr和weak_ptr,读者将了解它们的原理、用法和适用场景。本文将重点介绍智能指针的优势,如自动内存释放、避免内存泄漏和循环引用等问题。此外,还将讨论智能指针与传统指针的区别,并提供一些最佳实践和实用技巧,帮助读者在实际项目中正确、高效地使用智能指针。

Lion_Long的博客 1205

SpringBoot中正确显示jsp Whitelabel Error Page

当我们激动地创建好第一个自己的SpringBoot项目是,访问jsp却发现出现了不能访问的情况。因为SpringBoot 大力推荐我们使用的是ThymeLeaf格式,所以在jsp上没有很好地支持。 我们需要拿jsp练习,可以参考如下解决办法。 首先我们最最最先做的是要引入jsp依赖,可能很基础,但我就忘了。。 通常没有引入jsp依赖出现的情况是你访问jsp网页,会自动下载jsp,而不能展示。 <dependency> <groupId>org.apac

自闭吉普赛的博客 758

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

jsp error-page没有生效

1、首页检查web.xml中的配置,确保路径是正确的 <error-page> <error-code>404</error-code> <location>/error.jsp</location> </error-page> 2、然后再检查error.jsp文件内容是否有问题,比如只有<head>,没...

weixin_30652897的博客 374

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

error-page和jsp-config

404     /error404.jsp     java.lang.Exception     /exception.jsp 包括 和 两个子元素。          其中元素在JSP 1.2时就已经存在;而是JSP 2.0 新增的元素。     元素主要有八个子元素,它们分别为:          1.:设定的说明;     2.:设定名称;

zhujiaxing666666的专栏 677

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

springboot集成jsp报错Whitelabel Error Page

在springboot使用上,当做到在jsp上使用时出现了以下错误:我的天,我哪里错了吗? 目录结构有问题:jsp页面应该放置在/src/main/resources/META-INF/resources/WEB-INF/JSP下面,其中/WEB-INF/JSP和配置文件application.properties中配置的MVC前缀一致 spring-boot 中  @restControll...

bug大牛的博客 2082

spring boot2.0 创建 及 mvc视图映射 jsp时 Whitelabel Error Page(一)

spring boot 的创建方式有多种,1.直接去官网,选好所需的组件,下载一个demo运行 https://start.spring.io/2.如果你用的是eclipse 或 myeclipse,可以利用插件直接生成,不用去查找响应的组件包 (百度eclipse 创建springboot就有)3.就是创建一个maven项目,自己配pom.xml, 其实springboot项目 就是 一个mav...

Michael_Joy的博客 996

spring boot使用jsp界面,遇到whitelabel error page

spring boot的hello world,尝试一些小试验,使用jsp界面时,遇到错误 根据文件目录,首先应该排除controller找不到的问题,因为helloController和DemoApplication在同一个文件目录下。 正确的解决办法是: pom文件tomcat的scope不能是provided,注释掉就好了。 ...

yoyofu007的博客 2089

jsp之page指令

jsp中的page常用属性: autoFlush:值为:true/false,当值为true,当缓冲区满时,到客户端的输出被刷新;如果设置为false,当缓冲区满时,将出现异常,表示缓冲区溢出。默认为“true”; buffer:指定到客户端输出流的缓冲模式。如果为none,则表示不设置缓冲区;如果指定数值,那么输出的大小就必须小于这个值。此属性要和autoFlush一起使用,默认大小不...

keithJava的Blog 306

SPRINGBOOT整合JSP报404(WHITELABEL ERROR PAGE)解决方案整理

很多小伙伴在刚开始用Springboot整合jsp开发时都会遇到这个问题, 按照别人的教程一步一步搭建, 但就是会报404, 在网上找遍了方法都解决不了。笔者以前学springboot的时候因为这个问题忙活了整个下午才把问题解决,。最近看到有小伙伴在群里问, 所以打算把我已知的解决方法整理起来, 希望对大家有所帮助。不足之处,欢迎大家指正, 若还有其他方法, 欢迎补充。 首先这个问题很诡异, Springboot版本的不同, IDEA的版本不同, 都有可能造成404, 笔者有2017,2018,20.

dpp10683401的博客 6956

springboot加载jsp出现Whitellabel Error Page status=404

springboot使用jsp作为前端,可以返回json数据无法获得jsp页面报404,最终解决方案 IDEA中需要加载工作路径,,,我出错的地方

止境博客 275

jsp common PopUp Error Page

MFErrorMessageView objErrorView =  (MFErrorMessageView)MemfisGenUtility.getRequestAttribute(request,MemfisConstants.ERROR_VIEW_OBJECT);    MemfisErrorDom [] objMemfisErrorDom = objErrorView.getErr

疯狂程序员 848

forward error page(JSP)

 需要forward的页面: language="java" import="java.sql.*,javax.servlet.*,javax.servlet.http.*" errorPage="/error.jsp" %>//这个页面一定会出错。int i=0;int j=1;out.println(j/i);%>被forward到的页面:err

wangfang_0728的专栏 627

springboot整合jsp会报Whitelabel Error Page

这里需要你的在你的idea中进行配置,这里是springboot和idea有一点点冲突

henshuia的博客 238

Springboot整合jsp报404(Whitelabel Error Page)解决方案整理

很多小伙伴在刚开始用Springboot整合jsp开发时都会遇到这个问题, 按照别人的教程一步一步搭建, 但就是会报404, 在网上找遍了方法都解决不了。笔者之前因为这个问题忙活了整个下午才把问题解决, 现在把解决方法整理起来, 希望对大家有所帮助。不足之处,欢迎大家指正, 若还有其他方法, 欢迎补充。 首先这个问题很诡异, Springboot版本的不同, IDEA的版本不同, 都有可能造成4...

枨曦的博客 2720
上一篇: Cisco Syslog 处理
下一篇: 在 Tomcat 中使用 JSTL
ginkov
博客等级 码龄11年 72粉丝 65原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值