extjs中字符串和对象之间的转换,实现前后台传值

js 数据类型转换总结笔记 NULL 博文链接:https://mzl-2011.iteye.com/blog/1065985 立即下载
前台:
onRBtnClick : function(button, e, eOpts) {
		var form = button.up('form');
		var sampleNum = form.queryById('sampleNum').getValue();//获取组件属性值
		var sampleType = form.queryById('sampleType').getValue();
		var sampleDate = form.queryById('sampleDate').getValue();
		sampleDate = Ext.Date.format(sampleDate, 'Y-m-d');//日期转换

		var info = new Object();//new对象
		
                info .sampleNum = sampleNum;//把获取的值放入对象中
info.sampleType = sampleType;info.sampleDate = sampleDate;str = Ext.JSON.encode(info);//解析对象form.submit({url : 're/generate',method : 'post',params : {reportAdditionalInfo : str//传字符串到后台},success : function(form, action) {Ext.Msg.alert('信息提示', action, result.message);win.close();},failure : function(form, action) {Ext.Msg.alert('信息提示', action.result.message);}})},

后台:
public void generate(HttpServletRequest request, HttpServletResponse response,String info) {
		ObjectMapper objectMapper = new ObjectMapper();//new ObjectMapper
		ReportAdditionalInfo reportInfo = null;
		reportAdditionalInfo = StringEscapeUtils.unescapeHtml(reportAdditionalInfo);//不写会报错,解析出错
		try {
			reportInfo = objectMapper.readValue(reportAdditionalInfo, ReportAdditionalInfo.class);//readValue
		}  catch (IOException e1) {
			e1.printStackTrace();
		}
		
		String num = reportInfo.getNum();//获取值
		String type = reportInfo.getType();
		String date = reportInfo.getDate();
}

纯JS实现SM3加密算法(兼容IE浏览器) 纯JS实现SM3加密,IE、谷歌、火狐等浏览器可以直接使用。 阅读详情

相关推荐

vesta软件_分子动力学计算实战:利用 OVITO 软件找弗伦克尔缺陷和位错环分析

今天继续和大家分享这篇纯分子动力学(MD)的 Nat. Comm. 文章(DOI:10.1038/s41467-018-07102-3)。上期推文(从一篇 Nat. Comm. 学习经典分子动力学基本知识和相关软件基本操作 (一)),我们借用该文章的 fig.1 简单介绍了如何用文中所提到的 LAMMPS 软件来实现材料中级联碰撞过程。但是,想完整的展示类似该文章的 fig.1,单纯利用...

weixin_39524842的博客 5983

EXT 字符串与js对象的转换

Ext.util.JSON.encode(params):   将JS对象转成字符串,常用于需要向后台传数据之前。 Ext.util.JSON.decode(params) :   将字符串转成JS对象,常用于从后台接收数据之后。

linan0930的专栏 6538

Conformal LEC逻辑等价性检查介绍和参考脚本

分为三个产品:Conformal L、Conformal XL、Conformal GXL。L是功能性检查,XL支持复杂数据通路的综合和APR优化,GXL支持定制的stdcell和定制memory的检查。Cadence Conformal Equivalence Checker,就是常说的LEC,可以用来验证RTL、门级网表、甚至spice网表的逻辑等价性。do文件是conformal的脚本文件,可以由综合工具(RTL Compiler/Genus)自己产生(write_do_lec),也可以手写。

NanDigits的博客 7250

Extjs url直接传参 和使用params传参:如何利用用URL传参带特殊字符

在一般的情况下,url不能直接传一些特殊字符。如果一定要传,可以做如下处理: 有些符号在URL中是不能直接传递的,如果要在URL中传递这些特殊符号,那么就要使用他们的编码了。编码的格式为:%加字符的ASCII码,即一个百分号%,后面跟对应字符的ASCII(16进制)码值。例如 空格的编码值是"%20"。  如果不使用转义字符,这些编码就会当URL中定义的特殊字符处理。 下表中列出了...

xiayh04的专栏 714

3D Slicer:从入门到精通(二)——入门指南

本篇文章包含开始使用3D Slicer所需的信息,包括如何安装和快速开始使用基本功能,以及在哪里找到更多信息。

walt3433的博客 2万+

极验第四代滑块验证码破解(三):滑块轨迹构造

极验第四代滑块验证码破解(三):滑块轨迹构造声明 声明 原创文章,请勿转载! 本文内容仅限于安全研究,不公开具体源码。维护网络安全,人人有责。 本文关联文章超链接:

帯泪的鱼的博客 8624

extjs读取服务器信息,将响应从服务器(JSON对象)转换为extjs中的字符串

*在我们的代码中,来自Ext JS页面的参数被传递到Spring 3控制器,我们拥有业务逻辑。然后在控制器中,使用getWriter.write设置响应对象,并在Ext JS页面中检索响应。 问题:在解码响应时,Firebug在使用Ext.util.JSON.decode时显示错误,因此我们不得不使用Ext.decode来解码来自服务器的响应。但Ext.decode提供了一个值:object Ob...

weixin_39748928的博客 569

STM32实战:手把手教你移植CanFestival协议栈(附完整代码)

本文提供了一份详尽的STM32平台移植CanFestival协议栈的实战指南。文章从工程搭建、定时器驱动、CAN硬件适配到对象字典配置,手把手讲解核心步骤,并附完整代码示例。重点剖析了时间管理、报文收发等关键环节的实现与常见问题解决方案,旨在帮助开发者深入理解并成功实现CANopen通信。

kiwi8的博客 274

extjs4.2中JSON对象和JSON字符串转化

最近研究extjs中Json解析问题,其中JSON转化问题,直接见测试代码:<meta charset="utf-8"> <title>Welcome to Ext JS 4.2</title> </head> <script type="text/javascript" src="ext-all-debug-w-comments.j

ruijiao_ren的博客 5046

【光子 AI 】应用 LangGraph 的核心模型和算法原理,完整实现一个极简版的 Agent 开发框架源代码,并给出具体的应用测试实际项目案例

下面给出一个“极简版 LangGraph 风格 Agent 框架”的完整可运行实现:用 有向图 + 状态(State) + 节点(Node) + 条件路由(Conditional Edge) + 循环(Loop) + Checkpoint 这一套核心模型/算法,把 Agent 组织成可编排、可测试的状态机工作流(这正是 LangGraph 的核心抽象之一:以 StateGraph 组织节点,节点读写共享状态,边做路由与循环,并支持持久化/回放)。 参考概念来源:LangGraph 官方文档对 “StateG

AI天才研究院 270

cesium单向流动线效果

在学材质的路上一去不复返了属实是,难也难在这。还请各位大佬多多指教~

就zhei? 689

extjs4中json字符串和json对象转换

用extjs也有一段时间了,但有些东西就是记不住,就比如json字符串和json对象的转换,我还是把它记下来。 将json字符串转为json对象 var str = '{ "name": "张三", "age": "23" }' var obj = JSON.parse(str); 将json对象转为json字符串 var obj = { "name": "张三", "

chenmin_test的博客 1362

Python调用CANoe

我们可以创建CANoe应用程序对象,打开配置文件,启动模拟,发送和接收消息,并在完成后关闭CANoe应用程序。这使得我们能够使用Python自动化执行测试任务,并集成CANoe的功能到我们的Python应用程序中。CANoe是一款功能强大的汽车网络仿真和测试工具,它能够模拟和分析汽车网络通信,并提供丰富的测试功能。通过Python编程语言,我们可以方便地调用CANoe的API,实现自动化测试和集成CANoe的功能到我们的Python应用程序中。在CANoe中,我们可以为不同的汽车网络创建配置文件。

AzqLinux的博客 1287

extjs string类型转date_extjs datefield 后台传值 格式转化方法

今天用到extjs 的datefield,往后台传值,接收的是Thu Sep 2 00:00:00 UTC 0800 2010,而我想要的是2010/09/02。经过我搜索,终于找到解决方法了,原来是在页面取值时出了问题,不能用ext.getcom().getvalue,应该用ext.getcmp().getvalue.format('Y/m/d');赶紧试试吧! 最后别忘了给datafie...

weixin_39769627的博客 228

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

extjs datefield 后台传值 格式转化方法

extjs datefield 后台 日期 传值 取值 格式 转换

jsjxieyang的专栏 9063

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

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

关于EXTJS的decode和encode!!

最近在搞一个下拉列表combox的联动的问题,纠结了一下下,发现联动的关键就是:你怎么通过前台输入的数据或者是已经存在的数据,通过方法调用传给后台。然后,后台通过一系列的操作,帮你找到你需要的字符串字段或者对象,返回给前台。因为是EXTJS做的前台,所以有必要去看看decode和encode的关系。 下面我们别人的文章: 转自:http://blog.163.com/xiao_mege/blo

酒足饭饱勾二嫂,天真无邪假三叔 1220

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

Extjs的下拉框combo传多个值到后台

工作中遇到的一个问题,用extjs想后台传递多个值得情况下,后台每次得到的都是第一个值, (设置extjs 的combox 多选设置属性multiSelect :true ); 解决办法: 通过配置隐藏表单的形式: {                 name:'news_shequ',                 id:'news_shequ',               

wang_tao219的博客 3690

extjs的基本用法

                   关于json字符串 (jsonreader,gridpanel,viewport)写在客户端的代码(把一个从客户端传过来的map对象转换成json字符)String jsonStr=null;//定义一个空的字符串Map queryFilterMap = (Map)request.getAttribute("queryFilter");//从服务器上获得的

xiaorj的专栏 3324

Extjs 嵌套模型和如何保存为json字符串

1.嵌套模型(nested model) 在model中使用hasmany可以定义父子结构的嵌套模型,举一个实际的例子:Chart模型中包含坐标轴YAxis,Cell,Serie和PolyLine四个子模型,代码如下所示,hasmany定义了父子关系,当我们得到一个chart实例时,可以通过chart.Cells()得到以Cell为model的store。 Ext.define('A...

xhydongda的博客 395

EXT 中 json对象数组和字符串转换

===================== Ext.onReady(testJosonString() ); function testJosonString(){  var str="[{value:1,text:'a'},{value:2,text:'b'}]"; var list=[{value:1,text:'a'},{value:2,text:'b'}]; alert(str); ...

weixin_33998125的博客 1064

Extjs4.1 checkboxgroup获取数据库值设置 选中

最近在extjs4.1升级,升级以后出现了一些问题:显著就是checkboxgroup和radiogroup的取值和设置值的问题,在这里列出了例子给大家参考。     //将后台数据转换为'1'数组 function transtyle(v){    var arr=v.split(','); var c=new Array(); ...

skymym的专栏 823

extjs string类型转date_如何将 String类型 转换为日期格式 Date类型

有时候后台返回的日期值是这么一串数字:"20161101000000000"这时如果要format日期格式("2016-11-01")的话,我们首先需要将它转换为日期格式,具体实现方法可以写一个通用函数,代码如下:Ext.ux.formatDate = function(dateString){var newDate = new Date();var yearNum = Number(dateSt...

weixin_39821330的博客 700

ExtJS中DateField的值转换到.Net中DateTime结构体

namespace System { public static partial class StringExtension { public static DateTime ToDateTimeFromExtJsDateFieldValue(this string extJsDateFieldValue) { /*

h82258652的专栏 1228

extjs string类型转date_extjs日期显示(如何转换日期格式)

(在extjs中显示日期时间),后台传过来的数据是Date类型的数据(日期时间格式为timestamp,是13位的longdata数字类型的时间)sso/web/urlAccessGrid.js(Model,view以及facade三个都要看)日期类型传输的josn字符串为:2016-03-04T13:00:00.000+08:00(通过soapUI工具中的报文中截取出来的),这个就是UTC通用...

weixin_39746382的博客 592

Extjs 前台获取后台传过来的Json字符串

Extjs 前台获取后台传过来的Json字符串 var xx=Ext.decode( String json ) 转换后赋值给JS对象或数组,然后就可以访问对象的属性得到相应的值了(xx.属性)示例: var jstr = '{field1:"Iamstring",field2:1234567}'; var aobj=Ext.decode( jstr ); ale

hanchuang213的博客 5630

JSON和字符串相互转换

1. 将字符串转换为JSON对象:JSON.parse(jsonStr) 2. 将对象转换为JSON格式字符串:JSON.stringify(obj) 上面这种方式并不是兼容所有的浏览器,不说也知道,肯定又是IE不兼容。解决方式有多种,个人建议如果项目中使用的是ExtJs框架,那么直接使用ExtJs自带的方法。 1. 将字符串转换为JSON对象:Ext.JSON.decode(jsonStr

aboboo520的博客 4950
上一篇: extjs panel中动态增加items
下一篇: Extjs前台传值到后台出现中文乱码,解决
一颗卤蛋
博客等级 码龄14年 0粉丝 13原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值