Struts 2与AJAX初步入门(1)

Struts2中实现Ajax技术的全面指南 本文还有配套的精品资源,点击获取 简介:Struts2是一个Java Web框架,支持MVC架构,而Ajax技术能够实现无刷新页面交互,提升用户体验。本文将指导如何在Struts2框架中集成和应用Ajax技术,包括理解Struts2工作原理、通过引入jQuery库简化Ajax使用、创建和配置处理Ajax请求的Action类,以及通过配置文件和回调函数处理Ajax响应。同时,... 阅读详情

在当今--Web 2.0概念铺天盖地的Internet环境下,简易的AJAX集成对于一个成功的WEB框架来说是不可或缺的。因此,Struts 2其中的一个重要的功能(Feature)就是"First-class AJAX support - Add interactivity and flexibility with AJAX tags that look and feel just like standard Struts tags(大意:一流的AJAX支持--通过AJAX标志增加互动性和灵活性,而且使用这些AJAX标志与普通的Struts标志同样简单)"。

实现原理

基于不重新发明轮子的原则,Struts 2并没有开发新的AJAX框架,而是使用时下Java EE平台中比较流行的AJAX框架--Dojo和DWR。

最近在Musachy Barroso等同志的无私奉献下,开发了Struts 2的JSON插件(Plugin),极大地方便了我们输出JSON结果(Result)。

全文阅读:http://www.javah.net/Struts/20070614/2849.html

AJAX与Struts2框架下的JSON数组数据交互指南 Struts2框架是Struts框架的继承者,它在1.x版本的基础上进行了一系列的改进和发展。Struts2将Web层的设计模式抽象为MVC(Model-View-Controller),并将核心控制逻辑由Servlet转向了Filter,这样带来了更好的灵活性和扩展性。Struts2与Spring框架和Hibernate框架等主流Java技术栈整合得非常紧密,其主要特点包括:灵活性:Struts2通过拦截器(Interceptors)的机制,允许在请求处理的各个阶段进行插件式的行为拦截和修改。 阅读详情

相关推荐

Struts2与JQuery结合JSON实现Ajax异步加载

本文还有配套的精品资源,点击获取 简介:Struts2JQueryJson是一种将Struts2框架与jQuery库结合使用,通过JSON格式进行Ajax异步加载的技术方案。它提升Web应用的用户体验,通过无刷新页面更新来增强交互性和响应速度。本方案中,Struts2框架处理业务逻辑,jQuery库负责发起Ajax请求并更新页面元素,而JSON作为一种轻量级的数据交换格式,...

weixin_42509888的博客 1089

struts1中的jQuery ajax

上个星期做了上传Excel的功能,本来想使用jQuery的

David_lou的专栏 3168

【清风数学建模笔记】第十一讲:时间序列分析

【清风数学建模笔记】第十一讲:时间序列分析

manerzi的博客 833

Struts 2与AJAX

转贴自http://www.blogjava.net/max/archive/2007/06/12/123682.html Struts 2与AJAX(第一部分) 在当今——Web 2.0概念铺天盖地的Internet环境下,简易的AJAX集成对于一个成功的WEB框架来说是不可或缺的。因此,Struts 2其中的一个重要的功能(Feature)就是“First-class AJAX

icecityman的专栏 873

基于 Datawhale 开源量化投资学习指南(10):基于 LightGBM 的量化选股

通过本篇文章,我们深入探索了如何运用 LightGBM 机器学习模型实现量化选股。首先,我们通过获取股票的历史数据,进行特征工程和标签制作,将选股问题转化为一个分类问题。接着,我们使用 LightGBM 训练模型,并在验证集和测试集中评估了模型的表现。该选股策略的核心在于结合机器学习算法,从历史数据中寻找能够捕捉股票短期涨跌的关键特征,从而为投资者提供辅助决策支持。虽然本文的模型取得了一定的效果,但这只是量化投资领域的一小部分。

不想宅的冷同学 1347

《Kubernetes部署篇:基于x86_64+aarch64架构CPU+containerd一键离线部署容器版K8S1.33.3高可用集群》

《Kubernetes部署篇:基于x86_64+aarch64架构CPU+containerd一键离线部署容器版K8S1.33.3高可用集群》

东城绝神 1369

Struts2与ajax,ajax上传

一、使用ajax提交到Struts

游王子og的博客 731

scp 出现Permission denied错误 解决方法

第一种说辞(来源于网络),说是scp涉及root远程登录,默认是没有打开的,只需要把配置文件中的permit打开即可。最后scp的时候发现还不行,只需要将其scp的服务器用户名 修改为root即可。第二种解决方案,将scp 传输的服务器用户名改为root即可。(这是最基本的,一开始我忽视了这个问题,导致一直scp不了)window系统下,向ubuntu操作系统 scp传输文件。

码农研究僧的博客 6730

struts2怎么处理ajax请求

struts2接收ajax请求参数有三种方法首先说一下struts2是线程安全的,为什么说struts2是线程安全的呢,因为在struts2中struts2把所有的域对象全都封装到了actioncontext对象中,所以actioncontext对象的生命周期和request域对象的生命周期相同,也就是每次请求的到来会重新去创建一个actioncontext对象,所以请求与请求之间不使用相同的资源...

minolk的博客 6050

瑞数jsvmp算法还原流程讲解

​ 又是很久没写文章了,今天水一篇文章吧,鉴于之前有看到过别人的文章被警告的案例,所以这篇文章就仅写一下还原瑞数vmp的大概流程吧(仅记录下自己还原的思路)

博客 6608

前后端面试题【目录】

工作时候扭螺丝,面试时候造火箭,现状就是如此。不管是背八股文,还是掌握了知识的精华,对答如流才是硬道理。本专栏就是要集具前端精华,规范、算法、架构、封装、原理等一并汇集,让前端的小伙伴有个思路。, 欢迎一起交流,并非常期望您能够提供有价值的学习资料。

大剑师兰特的GIS世界 1837

Struts 2三种方式实现Ajax

Ajax本质上和普通的HTTP请求是一样的,只不过普通的HTTP请求是给人看的,而Ajax请求是给JS代码去用的。 所以Ajax请求的页面一般比普通的HTTP请求的响应内容还要简单,可能是一个页面的一部分,也可能是xml、json等结构化的数据,还可能是一个简单的字符串。 所以,在Struts 2中使用Ajax,Action一般就不会调用一个jsp视图来显示了(如果Ajax请求内容是页面的一部分也可能调用jsp视图),而是通过一些其他的方式。 下面介绍了三种方法,用于Action实现Ajax请求。

叉叉哥的BLOG 1万+

【25届数字IC秋招总结】面试经验10——紫光同芯

25届数字ic面试记录——紫光同芯

lalala0635的博客 863

Struts 2处理Dojo Ajax请求的一点经验

从Struts 1到Struts 2,从Dojo 1.5到Dojo 1.7、1.8,技术一直在进步,经验却需要时时更新。对于Web应用中最常碰到的Ajax请求处理,新版本的Struts 2和dojo 1.7做法就和以前不一样(在JAVA servlet中返回不同类型的AJAX response)。现在就拿一个例子说明如何从前台用Dojo通过Ajax请求将Json数据送回后台,后台检测后返回信息;顺

沧海一粟 —— 技术随手记 3808

【乐企文件生成工程】添加数据库、SpringEvent事件支持

更新!1、乐企版式文件生成工程添加数据库支持2、乐企版式文件生成工程添加事件机制,异步处理文件生成,提高系统并发能力。

九七的博客 336

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

ajax与struts1整合,jquery ajax 与 struts1和 struts 2

qjuery ajax 与分页 其他应用/p>"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN""http://struts.apache.org/dtds/struts-2.0.dtd">/error.jsp/index.jsp/user.jsppackage com.binda.action;impo...

weixin_31255215的博客 269

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

java ajax struts_Struts2 处理AJAX请求

struts2整合ajax有2种方式:使用type="stream"类型的使用json插件使用type="stream"类型的 获取text前端学号:姓名:查询成绩$("#btn").click(function () {$.ajax({url:"handleraction",type:"get",data:{"no":$("#no").val(),"name":$("#name").val()...

weixin_32248531的博客 320

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

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

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

Struts 2 + Spring 2 + JPA + AJAX 示例

struts官方教程中有这么一个例子,是Struts 2 + Spring 2 + JPA + AJAX 示例,其源地址是: http://struts.apache.org/2.3.1.1/docs/struts-2-spring-2-jpa-ajax.html 下载了例子后,手工导入包来构建,我使用了2.3.1的包,构建中遇到很多问题。主要是包关系的问题,以及STRUTS更新后的一些改变。

漫步 2114

Struts2 ajax的应用及其异常捕获缺点

ajax相关原理整合 * 导入jar包 struts2-json-plugin-2.1.8.1.jar 说明: 在该jar包中有struts-plugin.xml文件<struts> <package name="json-default" extends="struts-default"> <result-types> <resul

wsl9420的博客 892

struts2与ajax结合

struts2与ajax结合 struts2与ajax结合 按照惯例: * 加包 json-lib-2.1.jar、struts2-json-plugin-2.1.8.1.jar * 在struts2的配置文件中 ...

diaohui4839的博客 168

struts2的Ajax支持

Struts2实现Ajax的两种方式: 1.使用Stream类型的Result实现Ajax 2.使用JSON插件实现Ajax 使用Stream类型的Result实现Ajax: 1.新建LoginAction: public class LoginAction extends ActionSupport{ private String username; private String passw...

weixin_43638314的博客 372

struts2 ajax支持—dojo,Struts2与AJAX的相关概念以及使用Struts_Dojo插件.doc

Struts2与AJAX的相关概念以及使用Struts_Dojo插件Struts2与AJAX(第一部分)2009-05-08 08:40 by 墙头草, 749 visits,?网摘,?收藏,?编辑在当今——Web 2.0概念铺天盖地的Internet环境下,简易的AJAX集成对于一个成功的WEB框架来说是不可或缺的。因此,Struts 2其中的一个重要的功能(Feature)就是“First-c...

weixin_30134531的博客 347

《struts2权威指南》学习笔记之struts2 ajax标签s和submit

这个标签生成一个超级链接,用于像服务器发送异步请求,并将服务器响应加载在指定HTML元素中web.xml xml version="1.0" encoding="GBK"?>web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"    xmlns:xsi="http://www.w3.org/2001/XMLSch

我的世界我的梦 5096

struts2与springMvc下的AJax异步数据交互1

struts2与springMvc下的AJax异步数据交互1   无论是在struts2还是springMvc框架下,Controller或者action均有2种json数据返回方法 1.在struts2下 ① 一.使用Servlet的输出流     JSON接口的实质是:JSON数据在传递过程中,其实就是传递一个普通的符合JSON语法格式的字符串而已,所谓的“JSON对象”是指对这个

qq_25717027的博客 548

struts实现ajax,Struts 2中实现Ajax的三种方式

Ajax本质上和普通的HTTP请求是一样的,只不过普通的HTTP请求是给人看的,而Ajax请求是给JS代码去用的。所以Ajax请求的页面一般比普通的HTTP请求的响应内容还要简单,可能是一个页面的一部分,也可能是xml、json等结构化的数据,还可能是一个简单的字符串。所以,在Struts 2中使用Ajax,Action一般就不会调用一个jsp视图来显示了(如果Ajax请求内容是页面的一部分也可能...

weixin_34194482的博客 1091

1.struts中应用Ajax

jsp: <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> "> My JSP 'MyJsp

u013571243的专栏 544
上一篇: JTable上点击右键并弹出菜单的实现
下一篇: 无废话Apache+Tomcat配置
zaowei21
博客等级 码龄25年 38粉丝 517原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值