struts2的第一个helloworld

Struts2 HelloWorld示例(Maven项目) Struts2做的一个HelloWorld示例,使用Maven构建,导入请前先安装maven。 立即下载

   一、Struts2是一个优秀的web层框架,其他的需要了解请自行百度,在这里只简单地介绍其入门。


1、导包:

从已经下载的struts文件夹中打开如下,并将struts2-blank.war解压缩,这里面放着helloworld的入门jar包



2、在项目中创建一个POJO类,并将其命名为HelloAction,内容按以下格式书写:



3、在src下创建出struts的核心配置类,即struts.xml,其内容格式如下:



4、在WebContent下创建一个hello.jsp用以跳转:


5、配置web.xml中的过滤器


6、启动tomcat,在浏览器中输入如下地址,即可看到结果:



这就是struts2的一个快速入门




二、struts2的配置解析:

        

<struts>
		<package name="" namespace="" extends="struts-defalut">
			<action name="" class="" method="">
				<result name="">/xxx</result>
			</action>
		</package>
	</struts>

     package中可以配置name、namespace、extends等,其中name是包名(不是src下的包名),主要用来体现所包含action,的功能,如customer可以表示和顾客相关的功能的action;namespace表示浏览器访问的一个虚拟命名空间,用来定位到该包下的action,一般可写为/,表示不需要虚拟空间;extends是可选属性,一般写为struts-default。

    action表示的是对应Action类相关。name表示在该包下的访问名,浏览器可以用这个name进行访问,class不用说了,对应该Action的实体类路径;method表示该实体类中所要执行的方法,在执行完该方法后,会return一个字符串,result会根据name去接收这个字符串,如果返回值是result中的name,则执行跳转(result中默认的type为dispatcher)


struts2的常用常量配置

<!-- constant配置常量配置 国际化 解决乱码 -->
	<constant name="struts.i18n.encoding" value="UTF-8"></constant>
	<!-- 配置开发者常量 1、热加载 2、提供更多的错误提示 -->
	<constant name="struts.devMode" value="true"></constant>
	<!-- 动态方法调用 -->
	<constant name="struts.enable.DynamicMethodInvocation" value="true"></constant>

搞定安卓11+抓包难题:用Kitsune Mask、magic_overlayfs和LSPosed三件套绕过SSL Pinning(保姆级教程) 本文详细解析了安卓11+系统中抓包面临的核心挑战,包括SSL Pinning和Root检测机制,并提供了使用Kitsune Mask、magic_overlayfs和LSPosed三件套的完整解决方案。通过动态分区技术解析和工具链配置,帮助开发者绕过安全限制,实现高效抓包分析。 阅读详情

相关推荐

Julia Ann老司机管理系统

https://content.badgirlsusa.com/Julia_Ann-Sexy_Julia_Ann_Fucks_A_Lil_Elf's_Big_Cock_/Julia-Ann-Naughty-America-%E6%80%A7%E6%84%9F%E7%9A%84%E8%A3%98%E8%8E%89%E5%A9%AD%E5%AE%89%E4%BA%82%E6%90%9E-lil-%E7%B2%BE%E9%9D%88%E7%9A%84%E5%A4%A7%E5%85%AC%E9%9B%9E-2020

www_oracle_com的博客 22万+

(一)Struts2入门——HelloWorld

一、Struts2 概述 Struts2 是一个用来开发 MVC 应用程序的框架。它提供了 Web 应用程序开发过程中的一些常见问题的解决方案: 对来自用户的输入数据进行合法性验证 统一的布局 可扩展性 国际化和本地化 支持 Ajax 表单的重复提交 文件的上传下载 …… Struts2 VS Struts1 在体系结构方面更优秀: 类更少, 更高效: 在 Struts2 中无需使用 “A...

刘伟佳的博客 478

支付宝周期扣款实战:从签约到主动扣款的完整Java代码与避坑指南

本文详细介绍了支付宝周期扣款功能的完整Java实现流程,从协议签约到主动扣款的各个环节,包括业务模型设计、签约接口实现、异步通知处理、主动扣款技术等关键步骤。针对开发中常见的陷阱和问题,提供了实用的避坑指南和代码示例,帮助开发者高效实现连续支付功能,提升用户留存率。

weixin_27199085的博客 376

Struts 2 实例--Hello World

As you learnt from the Struts 2 architecture, when you click on a hyperlink or submit an HTML form in a Struts 2 web application, the input is collected by the Controller which is sent to a Java class

xwlxw的专栏 811

黑群晖二合一已损毁_手动修复黑群晖已损毁磁盘空间

lz的用法是这样的,一个中古级mac mini 2011上装有vmware esxi 7.6, 然后上面挂载了lz的华芸Asustor Nas的iscsi空间,lz用的是basic volume,然后esxi上面有虚拟的黑群晖6.2.2-24922,黑群晖的docker里跑着不可描述软件,但是发现下载速度过快时,比如有好几个文件同时下载,总速度超过60MB/s以后storage manager里很...

weixin_39669629的博客 1万+

【Java基础篇】Java重要特性,JDK,JRE,JVM区别和联系,环境变量

JDK使用时的执行流程: • 开发者视角(需要开发java程序):需要安装JDK a. 首先使用JDK调用Tools&Tool APIs(开发者工具)编写好Java程序--xxx.java b. 再次调用Tools&Tool APIs中的javac.exe(编译程序)来编译.java文件(将java文件编译成字节码.class文件) c. 调用java.exe来启动JRE d. 在JRE上运行JAVA字节码(加载特定的.class文件,调用这个class文件中的main方法

Yaoyao2024的博客 2163

Struts2之HelloWolrd

Hello World程序 以下是建立Struts2的HelloWorld程序的详细步骤:编写web.xml,添加如下配置:<!-- 配置struts2过滤器 --> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filte

a3060858469的博客 348

CKA-CN考试之路----1

后的的任意位置,但-n 和autoscale 必须是相连的.后面不再对命名空间部分做解释了.说明配置正确,如果无法保存退出,再次检查对齐.不用怀疑一定是复制的时候少了字母或者对齐出错.运行以下命令确认红色箭头的值和题目要求是否一致。将文档中的内容复制并粘贴到对应位置.,后续不再提醒yaml的对齐。确认脚本check1.sh。

Q先生 609

struts2入门helloword

这一是入门级别helloword 1、添加struts必须的一些的jar包 asm-3.3.jar asm-commons-3.3.jar asm-tree-3.3.jar commons-fileupload-1.3.1.jar commons-io-2.2.jar commons-lang3-3.2.jar freemarker-2.3.22.jar javassist-3.11.0.GA.jar log4j-api-2.2.jar log4j-core-2.2.jar ognl-3.0.6.jar s

微笑一号的博客 328

白皮精读:70页 2025 基于数据空间的金融数据可信流通研究报告【附全文阅读】

金融数据可信流通面临法规、技术与商业模式的挑战。报告分析国内外发展现状,提出基于数据空间的可信流通框架,包含典型场景、技术方案与流通模式。实践案例显示,隐私计算、区块链等技术可提升风控效率与合规性。建议完善数据分类分级、统一技术标准并推动行业试点,以释放数据要素价值,促进数字经济发展。

cdfunlove的博客 850

【32】OpenCV——图像含义关系?RGGB , BGGR , GRBG , GBRG呢?raw8,raw10,raw12,raw14呢? YUV422; RAW16呢?YCbYCr/RG_GB;

‌如前所述,定义原始数据的位深精度。‌* ‌一种压缩色彩编码方式,通过色度抽样(亮度Y全分辨率,色度U/V半分辨率)减少数据量,常用于视频传输。‌* ‌可能指每个像素分量占16位存储(如高位填充的RAW10/12/14),或未明确量化的高精度原始数据。‌ ‌分类‌核心定义‌关联性及典型应用传感器原始色彩排列(RGGB/BGGR等)决定RAW数据的色彩分布规则RAW位深每个分量的数据精度(8/10/12/14位)影响动态范围和存储空间‌YUV422。

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

Struts2 我的第一个Helloworld

先说一下Strtus的简介 Strtus采用的MVC模式 。 可以这样说 MVC模式是接口 而Strtus是实现类 Struts是面向对象设计 将MVC模式“分离显示逻辑和业务逻辑”的能力 发挥的淋漓尽致。Struts框架 的核心是一个弹性struts的控制层 基于如 Java Servlet,JavaBean 与XMl等标准技术 ,以及Commons类库。 Struts由一组相互

sinat_34469736的博客 303

免杀思路总结

免杀思路总结 1.免杀技术简介 1.免杀的重要性 2.免杀的难度 3.杀毒软件的排行 国外 国内 1 、Bitdefender 1、360 2 、Norton 360 2、智量安全(没测过,据说很厉害) 3 、Kaspersky 3、火绒安全 4 、Webroot 4、金山独霸 5 、Trend Micro 5

LiBai'S BLOG 1万+

Struts2入门第一个程序HelloWorld

struts2入门教程

zhaoliang092011的专栏 1万+

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

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

struts2的第一个程序 helloworld!

1.下载struts2 2.创建project----》struts2 3.将struts2-blank.war后缀改成.zip之后解压 4.在/struts2/WebContent/WEB-INF/下创建lib文件,并将\struts-2.3.37-all\struts-2.3.37\apps\struts2-blank\WEB-INF\lib里的jar包复制过来 5.配...

sxl200852的专栏 278

ET2012新版免狗免安装绿色软件

ET2012新版免狗免安祖昂绿色软件。,新界面,新视觉,

第一个Struts2程序,helloworld

第一个struts2程序,整了将近一天,好激动。嘿嘿 web.xml struts org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts /* s2...

xiaojin111的专栏 183

struts2下的helloworld(如何让第一个struts2跑起来)——struts2第一讲

注:文章中的全部图片均在附件中明确表明   首先要安装jdk1.6以及tomcat6和myeclipse 对于这些配置的安装 这里不再细细说明 因为网上好些地方都有的 给个链接吧 http://blog.sina.com.cn/s/blog_5116f6310100b889.html  其次是下载struts2  第一步:去struts21的官网 http://struts.apache

xyjikl 423

Struts2笔记——第一个实例HelloWorld

1、创建新的Dynamic Web项目 ------------------------ ------------------ 2、struts2框架配置 ------------------------ ------------------ 3...

chuanke1344的博客 109

Struts2第一个实例HelloWorld

1、创建新的Dynamic Web项目   ------------------------------------------ 2、struts2框架配置   ------------------------------------------ 3、创建类HelloAction,添加sayHello属性和定义返回值为String的excute无参方法 * 需注意的是,这里的

pwc1996的博客 1088

第一个Struts2的应用HelloWorld

[size=large]步骤1: 在默认的配置文件struts.xml 中加入如下配置: /WEB-INF/page/hello.jsp Struts.xml配置中的包介绍: [color=red]在struts2框架中使用包来管理Action,包的作用和java中的类包是非常类似的,它主要用于管理一组业务功能...

guliuchuan1234的专栏 184

第一个struts2实例——HelloWorld

内容提要:本文以一个“Hello World”的简单例子,开始struts2之旅。 开发环境:eclipse3.5+jdk6.0+tomcat7.0+struts2 项目目录结构: 详细步骤: 1、打开Eclipse,新建DynamicWebProject,打上项目名struts2,配置Targetruntime选择tomcat,然后直接点Finish。 2...

weixin_30794491的博客 137

struts2第一个HelloWorld项目

基本项目文件框架如下:   对于需要的jar包,可以直接在Struts2.zip包下面的lib包里面拷贝,但是有些jar包却没有,可以直接在Struts2.zip下app文件夹下解压struts2-blank.war(可以修改后缀名为.zip or .rar 进行解压)   struts.xml           "-//Apache Software Foundation//

snn1410的专栏 832

在Eclipse中配置Struts2第一个HelloWorld项目

在Eclipse中配置Struts2第一个HelloWorld项目 运行环境:Eclipse + Struts 2.1.6 + Tomcat 一、安装相关的文件 1 安装JDK6。 2 安装Tomcat,直接解压缩版。 3 安装Eclipse,直接解压缩版。 4 解压缩Struts2.1.6,在APPS目录下有几个.war文件。可以使用WINRAR打开,我们仅解压struts2-b

kaixinbingju的专栏 768

Struts2 学习总结(一):用Struts2编写第一个HelloWorld!

两种早期的JSP开发模型: 模型一:JSP+JavaBean Jsp负责页面的显示 JavaBean负责存储数据和实现业务逻辑 如图: 由于需要在jsp页面中编写流程控制和调用javabean代码,所以当逻辑变得复杂起来时,jsp页面就变得十分复杂。 适用于:小型应用,业务逻辑不复杂的应用 模型二:JSP+JavaBean+Servlet(MVC架构) JSP:负责页面显示 ...

知且行的博客 403

我的第一个struts2应用,HelloWorld!!!

最近跟着struts2文档学习了一下,英文实在是很折磨人,不过感觉上面的代码还可以,自己留着用,也可以大家看看。 简单的建立struts2的环境,首先下载struts2的一个版本,不是最新版也可以,然后解压找到apps目录,里面放着的是struts2的一些示例应用,随便打开一个,把里面的jar文件复制到你建立的web项目中的/WEB-INF/lib目录下。 下面是配置web.xml文件,增加s

zclandzzq的专栏 597

struts2第一个程序 Helloworld

1. 新建项目: MyStruts2 2.导入相应的jar包: 3.修改web.xml文件: <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.St...

weixin_30344795的博客 168
上一篇: 各种编程资源百度云
下一篇: 如何用struts2获得ServletAPI?
BoringRong
BoringRong 领域专家: 后端开发技术领域 领域专家: 后端开发技术领域
博客等级 码龄9年 2万+粉丝 386原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

BoringRong

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值