深入探讨struts的ActionMessages消息机制

手把手教你配置UEFI Secure Boot:从密钥生成到系统验证(附避坑指南) 本文详细介绍了如何配置UEFI Secure Boot,从密钥生成到系统验证的全过程,包括PK、KEK等关键密钥的生成方法,以及常见问题的解决方案。通过实战案例和避坑指南,帮助用户有效提升系统启动安全性,防止恶意软件植入。 阅读详情

深入探讨struts的ActionMessages消息机制


2007-11-22 10:23:01
版权声明:原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。 http://leaze.blog.51cto.com/83088/51750
    在介绍ActionMessages前,我觉得有必要先介绍一下ActionMessages的数据结构.理解了其数据结构有助于理解相关的各种操作.
    ActionMessages以一个HashMap存储ActionMessage.Map中的key是一个标识,其对应的value是一个List对象,所有的ActionMessage存储在List中.也就是说key标识了一组ActionMessage.
    先介绍涉及到的类中的几个常用方法,然后给出几个示例代码,帮助理解.
  • ActionMessage
    • ActionMessage(String key)
      该方法接受一个字符串,字符串是在资源文件种配置的key值,必须在配置文件中进行相关配置.
    • ActionMessage(String key,Object value)
      ActionMessage(String key,Object value0,Object value1)
      ActionMessage(String key,Object value0,Object value1,Object value2)
      ActionMessage(String key,Object value0,Object value1,Object value2,Object value3)
      上面4个方法第一个参数同样是资源文件中配置的key值,同样必须在配置文件中进行相关配置.后面的参数为资源文件中key所对应的信息中需要的参数
    • ActionMessage(String key,Object[] values)
      这种方法第一个参数同上,第二个参数接受一个Object数组,其中保存key在资源文件中对应信息需要的参数.
  • ActionMessages
    • ActionMessages.add(String property,ActionMessage message)
      第一个参数property对应于<html:messages>标签中的property属性,具体使用方法在后面介绍. property的值一般采用ActionMessages类中的静态常量ActionMessages.GLOBAL_MESSAGE,也可以自己定义一个key.该方法执行时,先判断ActionMessages中有没有该key,如果没有就新添加对key-List键值对;如果有同样的key,就先获取该key对应的Value并转换为List对象,然后将(ActionMessage)message添加进List对象中.
    • ActionMessages.add(ActionMessages ams)
      该方法将参数中保存的ActionMessage合并到调用ActionMessages中.
  • Action及其所有子类
    • addMessages(HttpServletRequest request,ActionMessages messages)
      该方法首先检查request对象中是否有ActionMessages对象,如果有对象,则将接收的ActionMessages合并到request中,如果没有,用setAttribute(Globals.MESSAGE_KEY,messages)方法将messages添加进去.如果一个Action中需要显示多条错误信息,推荐使用该方法.(Globals.MESSAGE_KEY = "org.apache.struts.action.ACTION_MESSAGE")
    • saveMessages(HttpServletRequest request,ActionMessages messages)
      该方法保存messages时,如果request中已经有一个ActionMessages对象,则用新的覆盖原有的.不推荐使用该方法,该方法容易发生丢失信息的情况.
    • addErrors()和saveErrors()
      这两个方法与addMessages()和saveMessages()相似,不过在HttpServletRequest.setAttribute()时的参数不一样,这两个方法是:setAttribute(Globals.ERROR_KEY,messages)添加的.(Globals.ERROR_KEY = "org.apache.struts.action.ERROR")
           在request中添加的ActionMessages在页面显示时,用<html:messages>标签进行显示,下面介绍一下该标签和经常配套使用的<logic:messagePresent>标签.
          <html:messages>
 id 必须指定id属性.<html:messages>标签作用是遍历ActionMessages对象中的所有    ActionMessage.类似<logic:iterator>,每次循环都定义一个名称为id指定的页面范围的bean,然后用    <bean:write>标签进行输出.
 bundle 绑定一个MessageResources,不指定的时候从上下文中配置的资源中检索.一般不指定bundle属性.
 locale 指定本地化信息,不指定时和Session的本地化信息相同,一般不用指定.
 name 指定ActionMessages对象在request中的key.不指定时,默认用      GLOBALS.ERROR_KEY="org.apache.struts.action.ERROR",用Action.addMessages()方法添加的信息将不    被显示,用Action.addErrors()方法添加的信息才会被显示.一般不指定.
 property 指定哪些ActionMessage将被显示,与ActionMessages.addMessage(String property,ActionMessage am)中的property参数相对应.不指定的时候显示所有信息.
 header 指定一个资源信息key,在显示ActionMessages前打印到页面上,可选.
 footer 指定一个资源信息key,在显示完ActionMessages后打印到页面上,可选.
 message取值为true/false,默认为false.为false或不指定时,在request中查找key=Globals.ERROR_KEY的ActionMessages bean.当该属性设置为true时,在request中查找key=Globals.MESSAGE_KEY的ActionMessages bean,同时name属性的值将被忽略.
 
         <logic:messagesPresent>和<logic:messagesNotPresent>标签,只支持message,name,property3个属性,作用和<html:messages>相同,就不再介绍

下面给出一段代码,帮助大家理解,这里只写了关键代码.
1. Action 类中的部分代码:
ActionMessages ams = new ActionMessages();
    ams.add(ActionMessages.GLOBAL_MESSAGE,
                              new ActionMessage( "addMessages : global message", false));
    ams.add( "error", new ActionMessage( "addMessages : error message", false));
    ams.add( "info", new ActionMessage( "addMessages : info message", false));
     this.addMessages(httpServletRequest,ams);

    ActionMessages errorMessage = new ActionMessages();
    errorMessages.add(ActionMessages.GLOBAL_MESSAGE,
                               new ActionMessage( "addErrors : global message", false));
    errorMessages.add( "error",
                              new ActionMessage( "addErrors : error message", false));
    errorMessages.add( "info", new ActionMessage( "addErrors : info message", false));
     this.addErrors(httpServletRequest,errorMessages);

2.  JSP文件中的部分代码:
 

< html:messages id ="message" >
   < bean:write name ="message" />
   < br />
</html:messages>
<!-- 上面代码的输出结果:
  addErrors : global message
  addErrors : error message
  addErrors : info message
-->

< html:messages id ="message" property ="info" >
   < bean:write name ="message" />
  <br /> 
</html:messages>
<!-- 这段代码的输出结果为:
  addErrors : info message
-->

  
< html:messages id ="message" message ="true" >
   < bean:write name ="message" /> 
  <br /> 
</html:messages>
<!-- 这段代码的输出结果:
  addMessages : global message
  addMessages : error message
  addMessages : info message
-->

< html:messages id ="message" message ="true" property ="info" >
   < bean:write name ="message" />
  <br />
</html:messages>
<!-- 这段代码的输出结果为:
  addMessages : info message
-->

        如果结合上<logic:messagesPresent>标签,将可以做出自由度很高的错误信息显示效果,具体如何表现这里就不在细说了.<logic:messagePresent>的使用方法大家自己体会,我相信大家掌握了<html:messages>,一定能驾驭<logic:messagesPresent>
        对struts的ActionMessages的讨论就到这里,希望这篇文章能对广大刚接触struts的朋友们有所帮助. 
 
别再折腾Windows了!Ubuntu 22.04下USRP X310 + RFNoC + Vivado 2021.1开发环境保姆级搭建指南 本文提供Ubuntu 22.04下USRP X310 + RFNoC + Vivado 2021.1开发环境的详细搭建指南,涵盖系统优化、UHD驱动编译、Vivado配置及硬件验证等关键步骤,帮助射频工程师高效构建稳定的开发环境,显著提升FPGA开发效率。 阅读详情

相关推荐

保姆级教程:手把手带你复现APFNet论文的RGBT目标跟踪模型(附完整代码与数据集配置)

本文提供了一份详细的APFNet论文复现指南,涵盖从环境搭建到模型测试的全流程。通过解析多模态融合模块和渐进式训练流程,帮助读者高效完成RGBT目标跟踪模型的复现工作,特别针对训练和测试中的常见问题提供实用解决方案。

weixin_29056781的博客 356

Struts不同版本的区别

目前最流行的Struts版本为1.1和1.2。 1.2版本和1.1版本最主要的区别有: 1) 配置文件 struts-config.xml 中头部版本号不同: <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1

牛牛的梯田 1256

从“氛围编程“到“智能体工程“:AI编程范式的认知跃迁与工程实践

摘要: 2026年,ClaudeCode负责人鲍里斯·切尔尼提出用“智能体工程”(Agent Engineering)替代流行的“氛围编程”(Vibe Coding),认为后者过于主观,无法体现AI编程的系统化与工程化本质。智能体工程强调记忆系统、工具编排、任务分解、可观测性等核心技术,将AI编程从“玄学辅助”升级为可度量、可规模化的工程学科。本文通过对比术语差异、构建知识体系,并结合代码实例(如带记忆系统的代码生成Agent和可观测性系统),展示了智能体工程的实际应用。行业案例(如ClaudeCode的并

yyq916的博客 1068

Struts2处理类型转换错误上

一视图 1input.jsp <%@ page contentType="text/html; charset=GBK" language="java" errorPage="" %> <%@taglib prefix="s" uri="/struts-tags"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 ...

实践求真知 231

从零到一:手把手教你用C#开发AGV调度系统(附避坑指南)

本文详细介绍了如何使用C#开发高效的AGV调度系统,涵盖从环境搭建到核心算法实现的完整流程。重点解析了动态路径规划、多机协同等关键技术,并提供了实用的避坑指南和性能优化建议,帮助开发者快速构建工业级车辆控制调度系统。

blockchain9miner的博客 747

红帽RHCE考试下午-RHCE (RH294)任务概览[2021最新版]

RH294任务概览 考试时间4个小时,6台虚拟机,15道题 原来通过脚本或者集群做的题现在都需要使用playbook实现 考试时大概有6台虚拟服务器,都已经做好了互相的免密 做题在ansible控制节点workstation做,但是需要去其他虚拟服务器进行验证 考试时需要将6台虚拟服务器在考试环境全部开启,物理机界面点击左侧按钮启动 考试时Ansible所有playbook都放在普通用户目录中且都以普通用户执行 注意:考试时一定注意要求将playbook放在哪个用户的家目录中,就需要用指定的户登录做题!

SunMy的博客 5625

struts升级到最高版本后遇到的问题。关于actionmessage传递问题。

Struts2升级到最新版本遇到的一些问题 首先是更换对应的jar,如asm、common、ongl、struts等等。更换后发现系统启动不了,按照网上的介绍,先后又更新了slf4j-log4j12-1.6.1.jar和cglib-2.2.2.jar后,起来了,但运行系统报错:NoSuchMethodError ...context.get(Object),修改web.xml,去掉struts-...

weixin_34319999的博客 161

告别Arduino IDE!用VSCode搭建Arduino UNO R3开发环境(含代码补全配置)

本文详细指导如何用VSCode替代Arduino IDE搭建Arduino UNO R3开发环境,包含代码补全配置和高效开发技巧。通过安装必要插件、配置项目结构和优化工作流,可显著提升开发效率,特别适合复杂项目开发。文章还提供了常见问题解决方案和高级功能调优方法。

weixin_30698297的博客 483

struts2 判断actionMessages中是否有值

    在struts2开发中,我们常常会通过Action 的addActionMessage("xxxxxxxx")方法添加操作提示信息,然后在页面上通过标签&lt;s:actionmessage/&gt;来展现,若需要判断actionMessages中是否有值是可以通过hasActionMessages()方法来判断。...

坚持而不浮躁 423

Modbus通信从入门到精通_2_Modbus TCP通信详解及仿真(搭建ModbusTCP仿真环境:创建虚拟PLC并进行ModbusTCP通讯;寄存器与PLC中映射关系;适合理解如何编写上位机)

LocalPort”是PLC的端口,最终的设置如下图所示:(相关的设置都可以查看帮助文档)P#DB1.DBX0.0 BYTE28是以指针形式表示的DB1的DBX0.0开始(在使用的西门子Modbus tcp的程序块中设置的“MB_HOLD_REG”输出寄存器),其有28个字节(28个字节对应14个寄存器),4001是第一个寄存器,往后数14个即可。在上面的基础上,增加一个“DB1”的“组对象”,同时将“MW0”的组对象禁止(双击组对象,“Active”取消勾选),启动之后发现无法连接。

分享学习成长历程,Winter is coming! 1万+

论文翻译:arxiv-2023 Do-Not-Answer: A Dataset for Evaluating Safeguards in LLMs

随着大型语言模型(LLMs)的快速发展,出现了新的、难以预测的有害能力。这要求开发者能够通过评估“危险能力”来识别风险,以便负责任地部署LLMs。在这项工作中,我们收集了第一个开源数据集,用于评估LLMs中的安全保障,并以低成本部署更安全的开源LLMs。我们的数据集经过策划和筛选,只包含负责任的语言模型不应遵循的指令。我们注释并评估了六个流行的LLMs对这些指令的响应。基于我们的注释,我们继续训练了几个类似BERT的分类器,并发现这些小型分类器在自动安全评估上能够取得与GPT-4相当的成果。

CSPhD-winston的博客 1138

【转】深入探讨struts的ActionMessages消息机制

 <p class="MsoNormal" style="text-align:left;line-height:17.25pt;mso-pagination:widow-orphan" align="left"><span style="font-size:10.0pt;font-family:Verdana;mso-bidi-font-family:宋体;color:#103E7B

ssl vpn ------adito (ssl explorer) (openvpn als)&amp;amp;&amp;amp;网络安全 764

Open3D 计算点云的倒角距离(Chamfer Distance)【2025最新版】

;Chamfer Distance距离可以计算生成点云数据与标签点云数据之间的平均最短点距离。Open3D可以直接用来计算点云的Chamfer Distance距离。博客长期更新,本文最近一次更新时间为:2025年2月18日。

点云侠的博客 3258

深入探讨struts的ActionMessages消息机制(转)

[size=large]在介绍ActionMessages前,我觉得有必要先介绍一下ActionMessages的数据结构.理解了其数据结构有助于理解相关的各种操作. ActionMessages以一个HashMap存储ActionMessage.Map中的key是一个标识,其对应的value是一个List对象,所有的ActionMessage存储在List中.也就是说key标识了一组A...

vangraxy的专栏 171

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

ActionMessage&&ActionErrors介绍 .

在介绍ActionMessages前,我觉得有必要先介绍一下ActionMessages的数据结构.理解了其数据结构有助于理解相关的各种操作.     ActionMessages以一个HashMap存储ActionMessage.Map中的key是一个标识,其对应的value是一个List对象,所有的ActionMessage存储在List中.也就是说key标识了一组ActionMessag...

夜更深 165

深度学习工具包 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")

struts1 消息缓存机制

问题: 使用saveError(HttpSession,ActionMessages messages);保存了错误信息。 第一次返回时显示了错误信息,第二次发送请求时错误信息却没了,感到奇怪,深入了解便发现了struts1.x对 缓存信息处理机制的奥妙。 code: save error message       protected void saveErrors(HttpSessi...

soft_xiaohui的专栏 239

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

ActionError,ActionMessage介绍

尽管Struts框架提供了有效的异常处理机制,但不能保证处理所有的错误,这时Struts框架会把错误抛给Web容器,在默认情况下Web容器会向用户浏览器直接返回原始信息。如果想避免直接让用户看到这些原始信息,可以在web.xml中配置元素,以下代码演示了如何避免用户看到HTTP 404、HTTP 500错误和Exception异常。 web.xml [code="java"] ...

neil-jh 265

ActionMessage、ActionMessages、saveMessages()、saveErrors()、之间的用法和区别

ActionMessage功能是: 用来产生STRUTS消息的包括正常消息和错误消息。注(原有ActionError方法来产生错误消息,但已废弃,但仍可使用。)例: ActionMessage(key,object);其中key为在appication.properties中指的key值。object为消息中 要传入的参数,这里实现了动态传入。如果要传多个参数时,object处可以改为数组...

weixin_30621919的博客 367

重温经典struts1之ActionMessage(s)类结合html标签完成页面显示异常消息和正常提示消息

ActionMessage(s)类结合html标签完成页面显示异常消息和正常提示消息

dy051107的博客 1271

Actionerror标签和Actionmessage标签的用法

Actionerror和Actionmessage标签的用法:这两个标签的使用,在网上挺多答案的可是都不是我想要知道的那种答案。这一次我通过自己努力的尝试暂且知道了这两个标签的的用途拿出来和大家分享下。这两个标签的作用是一样的都是我们在前台页面传送信息到后台时在前台提示消息他们的唯一不同点就是他们Action实例的用不同方法的返回值;Actionerror使用的是getActionErrors()...

博客 1246

ActionMessages<转>

ActionMessages其实就是一个用于存储ActionMessage的HashMap,Map中的key是一个标识,其对应的value是一个List对象,所有的ActionMessage都存储在List中。也就是说,key标识了一组ActionMessage。 下面先介绍下ActionMessages消息机制涉及到的一些类: org.apache.struts.action.Action...

KINGWANGZHEN的博客 345

ActionMessages的使用

原来都是一直用struts1.1,所以一直以来都用ActionErrors,今天自己做了点东东,想用struts1.2了,但是它又不提倡用ActionErrors,只能转为ActionMessage了.就学了点..留下来...仅供以后参考...   1.在建struts时里面的struts-config.xml里面需要加入 &lt;message-resources parameter="Appl...

tony_0524的专栏 398

struts error和message标签学习

在formbean中的validate函数验证过之后直接return errors即可返回到INPUT页面,在action中验证完之后使用saveErrors(request,errors);来把errors保存到request范围内,然后使用return mapping.findForward("input");返回到input页面。 标签的属性:name表示根据相应的KEY名选择哪一

mydreamongo的专栏 1224
上一篇: 再说ActionMessages类及其用法
下一篇: Tomcat启动时报filterStart错
robin622
博客等级 码龄20年 15粉丝 127原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值