Struts2中Action间参数传递

今天在使用Struts2编写一个增删改查的例子时遇见在配置action时,需要给action的result对应的jsp或者action传递若干个参数的问题,如下配置代码所示: 

 

<action name="delSYS_RESOURCE" class="SysResourceAction" method="delSYS_RESOURCE">
	<result name="success" type="redirect-action">selectSYS_RESOURCE?RESOURCE_DM_SJ=${resource_dm_sj}&amp;RESOURCE_NAME=${resource_name}</result>
</action>

RESOURCE_DM_SJ和RESOURCE_NAME是我们通过url传递的一个参数名,resource_dm_sj和resource_name则是action中的一个实例变量,且具有相应的get和set方法。

 

注意:在上面的配置代码片断中,“&amp;”是“&”的转义字符,因为在xml文件中“&”是属于特殊字符,所以,在struts2的xml配置文件中,需要用到“&”字符时,需要将其转义为“&amp;”

Struts2 Action参数详细说明 Struts2 Action参数详细说明,很有用的。 立即下载

相关推荐

struts2中Action获取参数的3种方式代码

下载后解压直接导入到Myeclipse中发布到tomcat后运行即可,源代码没有错误,已运行试过,三种方法转换的时候需要修改strut.xml中的Action

Struts2学习笔记(六)——Action处理请求参数

在struts2框架中关于Action处理请求参数有两种方案(三个方式),表单属性的名称应该和在Action类中定义的成员属性或者在JavaBean中定义的成员属性名称一样: 1、属性驱动 1)直接在Action类中定义成员属性来接收请求参数 (将Action当成javaBean),在Action中还需要定义成员属性的setter方法。 表单信息: 1 <form actio...

weixin_34262482的博客 227

地下水热耦合模拟FEFLOW建模

2.3 依据讲解内容,练习构建地下水数值模型(例二),学会各种源汇项、边界条件、时间序列、节点参数的添加及模拟结果的导出。对于真实模型,学习如何建立概念模型、数学模型,练习模型的各种参数和源汇项输入,进行溶质运移、水热模拟。3.通过多种实践案例应用,掌握实践工作中常见项目的模型搭建及特殊问题处理方法。4.1学习水热模型抽灌模式,网格剖分、边界条件、初始温度场赋值。3.3练习模型的各种参数和源汇项输入,进行水流和溶质运移模拟。2.掌握水热耦合的模拟方法及典型项目应用问题处理。2.4根据模拟结果,

weixin_55561616的博客 964

Struts2编写Action及获取参数的三种方法

一、编写Action 的三种方法    1.创建普通类         自己创建的普通类需要人为定义常量SUCCESS,而且没有表单校验等功能,需要自己编写代码实现。 package com.test.struts2; public class TestAction2 { public String execute() { return "success"; } publ...

weixin_42249629的博客 1062

001:InVEST学习——产水/水源涵养

InVEST产水模块介绍 前言 (一些碎碎念着急的可以忽略)最开始做inVEST模型是2020年中,应该说对这个软件有很特殊的感情,之前一直想出一个教程,但是因为事情多加上拖延加上懒就耽搁了,事实证明东西不用就确实荒废了,现在面对当初自己做的东西顶多也就能想起一些思路,很多细节都忘了,所以这个教程也相当于是一个备忘录吧。 ...

Victoriaac的博客 2万+

数据仓库建模的步骤-从需求分析到模型优化的全面指南

数据仓库建模是一个系统化的过程,旨在设计和构建一个高效、可扩展的数据存储和分析环境。它的目标是将来自不同源系统的数据整合到一个统一的、面向主题的、随时间变化的数据集合中,以支持企业的决策制定过程。数据仓库建模不仅仅是创建表格和定义关系,它更是一门艺术,需要平衡业务需求、技术限制和未来的可扩展性。提供快速的查询性能支持复杂的分析需求适应业务的变化和增长保持数据的一致性和准确性接下来,让我们深入探讨数据仓库建模的每个主要步骤。

一个8年大数据开发工程师的碎碎念 2098

struts2action处理参数的三种方法

直接处理参数 package com.yz.action; import com.opensymphony.xwork2.ActionSupport; public class UserAction extends ActionSupport { /** * */ private static final long serialVersionUID = 1L; pri...

RoyalLAW的博客 311

深入Netflix影片分类数据抓取的Python爬虫实战:反反爬机制绕过与Playwright应用全解析

技术工具用途Playwright控制真实浏览器模拟用户行为开发语言asyncio异步调度浏览器任务pandas数据处理和导出sqlite3本地数据库存储支持随机UA模拟,增强反爬能力为什么选择 Playwright?✅ 支持多浏览器(Chromium、Firefox、WebKit)✅ 原生支持 Python 异步编程✅ 提供截图、滚动模拟、验证码处理等高级功能✅ 反爬能力强,模拟真实用户访问。

2201_76125261的博客 1239

struts2中action间的参数传递

注意一: "delSYS_RESOURCE" class="SysResourceAction" method="delSYS_RESOURCE">      "success" type="redirect-action">a.jsp?result=${b}&result2=${c}     解释:result和result2是我们通过url传递的一个参数名,

1933

Megatron-LM从头训练大语言模型:并行策略图示【Tensor并行、Pipeline并行、Data并行、Sequence并行、virtual_pipeline并行、Context并行】

节点包含的层每GPU的参数内存每GPU的激活内存节点0Stage 0层1-1212层参数/2 (TP切分)8k序列激活 (CP切分)节点1Stage 1层13-2412层参数/2 (TP切分)8k序列激活 (CP切分)节点2Stage 2层25-3612层参数/2 (TP切分)8k序列激活 (CP切分)节点3Stage 3层37-4812层参数/2 (TP切分)8k序列激活 (CP切分)负载均衡:每个节点处理相同数量的层(12层)内存优化。

u013250861的博客 285

自动化上位机开发C#100例:如何用面向对象的方式封装雷赛运动控制卡EtherCAT总线卡(C#代码)

自动化上位机开发C#100例:雷赛运动控制卡EtherCAT总线卡C#封装类。

十多年IT经验,专注机器视觉,智能制造半导体行业 5028

struts2中action间的参数传递 原因:“&”是“&”的转义字符

struts2中action间的参数传递今天在使用Struts2编写一个增删改查的例子时遇见在配置action时,需要给action的result对应的jsp或者action传递若干个参数的问题,如下配置代码所示: "delSYS_RESOURCE" class="SysResourceAction" method="delSYS_RESOURCE">      "success"

2193

SIMULINK开发项目实例 1000 例专栏之第802例--基于电机驱动系统的场景实例:永磁同步电机(PMSM)在电动汽车中的矢量控制仿真

随着全球对环境保护的关注增加,电动汽车(Electric Vehicle, EV)因其环保特性而受到广泛关注。永磁同步电机(Permanent Magnet Synchronous Motor, PMSM)由于其高效率、高功率密度和良好的动态响应性能,在电动汽车驱动系统中得到了广泛应用。矢量控制(Field-Oriented Control, FOC)是实现PMSM高性能控制的关键技术之一,它能够实现对电机转矩和磁场的独立控制,从而达到类似直流电机的控制效果。本文将详细介绍如何使用来构建一个。

xiaoheshang_123的博客 267

Struts2:action与action间的属性/参数传递

设置siteid属性与get/set方法 parameMethod.jsp text.action?parame1=${parame1} 传多个动态参数,使用【&】 result type="redirect">text.action?parame1=${parame1}&par

kaidishi的专栏 765

【23】C++实战篇——C++报错:LNK2001:无法解析的外部符号 ,LNK2019: 无法解析的外部符号,原因分析及解决方法

该文分析了VS项目中出现的"无法解析的外部符号"LNK2001/LNK2019错误。问题表现为跨项目共享变量时,Projector项目无法解析Line项目中声明的外部变量ImgSavePath和ImgFormat。原因在于头文件声明了变量但未包含实现的源文件。解决方法是将getLine.cpp文件添加到Projector项目中。文章还总结了两种错误代码的区别:LNK2001通常对应变量缺失,LNK2019对应函数缺失。最后列出了具体的报错信息,包括无法解析的变量和函数符号。

程序员,他们想的是什么?他们想的永远都是技术,他们崇尚的也永远都是技术。 2004

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

struts2中action向action之间传数据和action向jsp传数据理解

1,在 Action中我们经常会从这个Action跳转到另一个Action中,这时我们就要用到redirect、redirect-action、chain,       其中redirect和redirect-action是重定向,相当于浏览器二次请求,之前的数据都会丢失,所有的参数、值栈和请求属性都会丢失。chain是服务器转发action,源Action的用户请求参数、值栈、session的

tuke_tuke的博客 5598

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

struts2配置文件中参数的传递

struts2配置文件中参数的传递       在Action中我们经常会从这个Action跳转到另一个Action中,如果只是简单的跳转那么很容易,只需在struts配置文件中添加一个result,如:name="index">/manager/managerInfo/account.jsp.        result有一个type属性,这里的type默认是dispatche

nihousheng的专栏 2063

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

struts2中action的传值方式

在struts2中,action的传值方式是如何的呢,是不是会和MVC模式与struts2一样呢,下面我们来讨论一下,它的传值方式。1、首先写个jsp页面Code: %@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>   html>     head>  

lipingqingqing的专栏 1万+

struts2 Action间传递

上面LoginAction接受从Login.jsp界面的username,password方法,下面是Login.jsp页面主要代码 核心的Action间传值通过chain,struts.xml配置如下:"login" class="niit.struts2.user.action.LoginAction"> result type="c

beyond667的专栏 890

Struts2 两个Action之间动态传参

两个Action 动态传参数 研究了近两天的时间,终于把一个很简单的问题给搞定了,那它是什么问题呢?就是Struts2的两个Action之间传参的问题。 需求功能是这样:Action1 获取数据库配置内容,得到相应Model的 动态URL ,这里的URL 有的是Action有的是JSP页面。 1.使用result 类型中的 redir...

ych0108的博客 195

struts2的action与jsp之间传递参数

1、浏览器往Action传递参数:     在Action中设置属性,并为属性设置get/set方法。传递参数时按照属性的名字赋值即可。如xxx?name=aa     取值用request.getPrameters("属性名“); public class UserAction { private String name; private User

op134972的博客 403

Struts2 Action 动态传参数

Struts2的两个Action之间传参的问题。         需求功能是这样:Action1 获取数据库配置内容,得到相应Model的 动态URL ,这里的URL 有的是Action有的是JSP页面。  1.使用result 类型中的  redirect 类型,如下:            &lt;result name="success" type="redirect"&gt;${dynam...

weixin_33851604的博客 86
上一篇: Struts2中访问HttpServletRequest和HttpSession
下一篇: 成熟的架构+创新的扩展
javaRwx
博客等级 码龄20年 0粉丝 22原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值