记事贴2:Struts的Validator并不好用!

基于java实现的弹幕视频网站 开发语言:Java框架:ssm技术:JSPJDK版本:JDK1.8服务器:tomcat7数据库:mysql 5.7(一定要5.7版本)数据库工具:Navicat11开发软件:eclipse/myeclipse/ideaMaven包:Maven3.3.9系统展示弹幕视频网站,在弹幕视频网站可以查看首页、视频信息、商品信息、论坛信息、我的、跳转到后台、购物车、客服等内容前台首页界面图登录,通过登录填写账号、密码等信息进行登录操作登录界面图视频信息界面图。 阅读详情
最近用AppFuse开发一个BS的系统,用的是Struts的MVC部分,使用Validator进行验证,结果发现Validator的验证EMail并不好,EMail中可以输入汉字,然后到服务器端验证,我配置了客户端验证,也可以验证Email的格式,但如果输入的是正确的格式,但是包含汉字它却验证不出来,但到了后台又管用了,不知道为什么,时间紧,我也没时间去研究它,找到一个方法可以解决这个问题,虽不完美,却也凑合:

使用正则表达式,将原代码
            <html:text property="email" styleId="email" size="50"/>
注释,换成

            <input type="text" name="email" value='<c:out value="${userForm.email}"/>' onkeyup="value=value.replace(/[/u4E00-/u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[/u4E00-/u9FA5]/g,''))"
 />
就解决了问题,用户如果输入汉字,则自动删除汉字,而且如果使用向左的箭头向前移动使光标前移,则根本移动不了,光标始终在行尾,只能删除后面的字符,再重新写,其实最好是在EMail的自动生成的脚本中提示,目前先这样实现吧,将来再说!
【ROS2】从yaml文件中读取参数配置 ROS2:从yaml中读取参数,到节点;使用C++演示参数的增、删、改、查、遍历、监听变化 阅读详情

相关推荐

#基于原生JS的交互式代码高亮编辑器实现教程

本文介绍了一个轻量级交互式代码高亮编辑器的实现方案。该编辑器采用原生JavaScript开发,支持语法高亮、行号显示、主题切换等核心功能,适合嵌入博客、文档等场景使用。 项目技术栈包括HTML5/CSS3/JavaScript,使用Prism.js实现语法高亮,prettier提供代码格式化功能。编辑器界面分三个区域:顶部工具栏(语言选择/主题切换)、中间编辑区(行号+代码)、底部状态栏(语言/字符数)。 核心功能实现包括:通过contenteditable属性创建可编辑区域,Flex布局实现行号与代码同步

qq_42386733的博客 1042

Struts使用Validator

Struts使用ValidatorValidator框架是一种可插拔的系统,validator-rules.xml文件用于以声明的方式插入执行验证时validator将要使用的验证例程。 启用Validator插件struts-config.xml文件里加入   plug-in className="org.apache.struts.validator.ValidatorPlugIn">   

tyrone的专栏 3711

高压脉冲发生器的各种电路图

高压脉冲发生器的各种电路图

qq_65102825的博客 5914

struts2 validator验证一些注意事项

struts2 validator验证一些注意事项2007-12-20 11:13:57.0 作者:justin 来源:本站[收藏此文章]struts2可以像struts1一样,在Action中使用validator()方法进行验证,也可以使用校验规则文件进行验证.本文主要介绍的是使用校验规则文件方式进行的验证.1.件命名方式:ActionClassName-ActionAliasName-v

鹏飞的专栏 1447

保姆级教程:用AdGuard DNS代理实现全设备广告过滤(含Win/Mac/安卓/iOS配置)

本文提供了一份详尽的AdGuard DNS代理配置指南,帮助用户在全设备(Win/Mac/安卓/iOS)上实现广告过滤。通过系统级DNS设置,AdGuard能有效拦截广告、跟踪器和恶意网站,提升隐私保护和浏览效率。教程涵盖原理说明、各平台配置步骤及高级优化技巧,适合不同技术水平的用户。

weixin_42656416的博客 858

Vivado实战:如何用BUFGMUX_CTRL实现FPGA双时钟热切换(附时序约束模板)

本文详细介绍了如何使用Xilinx FPGA中的BUFGMUX_CTRL原语实现双时钟热切换的工业级解决方案。通过分析BUFGMUX_CTRL的核心机制、PCB布局约束和电源噪声抑制方法,提供Vivado实现全流程和时序约束模板,帮助工程师在工业自动化、车载电子等场景中提升系统可靠性。

weixin_29186249的博客 590

在struts中使用validator做页面验证

1. 在struts-config.xml文件中加入validator插件,加入这个插件后你的应用就具别的使用validator的环境,但是,要想真正的使用它还需要其他的配置。如:2. 在struts-config.xml文件中添加ApplicationResources配置文件。如:添加此文件的作用是提供错误信息的非编程定制化和多语言支持。如果我们使用中文平台操作系统,则默认情况下将首先查找Ap

eric88的专栏 1187

SAP Fiori Launchpad 概述

SAP Fiori launchpad 是托管 SAP Fiori 应用程序的 shell,并为应用程序提供导航、个性化、嵌入式支持和应用程序配置等服务。SAP Fiori Launchpad 是移动和桌面设备上 SAP Fiori 应用程序的入口点。启动板显示带有图块的主页,其中可以显示实时状态指示器,例如打开的任务数量。每个图块代表用户可以启动的业务应用程序。这包括 SAP Business Suite 事务应用程序和 SAP Smart Business 分析应用程序。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 940

struts2和jquery_validator简单使用

项目中时常会用到一些验证手段...由于在开发前需要对一些技术的定位!所以一般选择固定的验证框架和技术. 我在前台验证中使用的是jquery_validator.这是个容易上手的框架.个人感觉它和struts2结合在一起非常不错.下面讲下使用的过程. 准备的jar包:struts2可以到http://struts.apache.org/download.cgi下载 juery_val

yjw916622874的专栏 510

ros入门(八)---TF坐标转换

TF(TransForm),就是坐标转换,包括了位置和姿态两个方面的变换。

weixin_51157015的博客 3392

ximalaya 新xm-sign逆向思路

本文主要介绍目标网站新xm-sign值的逆向思路。仅代表个人理解,如有其他建议可在评论区沟通。声明仅仅记录一下自己的学习方法,不作为其他参考、更不作为商业用途。如有侵犯请联系本人删除。

weixin_66580433的博客 2020

struts中validator框架学习笔记

1.将ActionForm改为ValidatorForm,若是DynaActionForm,则将struts配置文件中的form对象改为DynaActionForm,因为要使用Validator进行验证,只能是ValidatorForm或DynaValidatorForm两种。2.将org.apache.struts.validator下的validator-rules.xml里的内容考过来,

VSlogin学习笔记 705

R语言caret拟合模型:train函数构建xgBoost Dart模型、模型调优、自定义设置trainControl函数和tuneLength参数

R语言caret拟合模型:train函数构建xgBoost Dart模型、模型调优、自定义设置trainControl函数和tuneLength参数

statistics+insight+vista+power 532

使Struts支持Validator

要在Struts项目中使用Validator功能,首先需要配置Struts项目,使其支持Validator框架.Struts通过一个插件(Plugin)来使Struts项目支持Validator.这个Plugin由Struts默认提供,用户也可以自己开发自己的Validator Plugin.Struts默认提供的Plugin为:org.apache.struts.validator.Valida

吾欲乘风 2568

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

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

struts中validator的使用

  关于在struts中使用validator,经过半天实践,有了些许体会(以struts1.2.7为例子)。  步骤如下:  (1)下载struts-1.2.7.zip,解压后,将webapps中的struts-examples.war解开,在WEB-INF文件夹中找到validator-rules.xml,还有WEB-INF/validator中的validation.xml。  (2

Materials gathered 500

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

struts中使用validator

 刚开始用validator,需要注意较多的细节,再稍微明白些后,建议看看struts-example。为了抛砖引玉,写个例子:一。在struts-config.xml中加入:     value="/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml" /> 在插件的配置中是通过pathnames属性来指定Validator的配

nalis的专栏 1120

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

在Struts中使用Validator验证框架详解

 Validatro框架以成为Jakarta的公共项目的一部分,可以从http://jakarta.apache.org/commons/下载单独的Validator框架,在Struts中已经呆了这个框架。 Validator主要依赖两个jar包 Jakarta-oro.jar:-提供一组处理文本的类,具有文本替换、过滤、和分割功能。 Commons-validator.jar:提

logicbiz的专栏 818

Struts的validator框架验证

        经过为期近两个月的项目练习,了解了开发一个实际项目它的具体流程及在每一个阶段都做哪些工作。在技术上进一步一步熟悉了Struts框架中的相关内容。在这里我想谈一下有关Validator框架验证和Struts标签的相关内容。1.        Validator验证框架Validator框架验证已经克服在ActionForm Bean的validate()方法中写验规则

技术交流 991

在struts中使用Validator框架

 在struts中使用Validator框架 Validator验证框架Validatro框架以成为Jakarta的公共项目的一部分,可以从http://jakarta.apache.org/commons/下载单独的Validator框架,在Struts中已经呆了这个框架。Validator主要依赖两个jar包Jakarta-or

Materials gathered 480

[Share]深度Struts之Validator

 在Struts中,Validator的作用非常大,他可以让用户从繁琐的页面验证工作中脱身,让页面验证工作放到配置文件里去做,Struts已经内置了如下这些我们经常使用的校验器:· validateByte  检查值能够安全地转换为byte· validateCreditCard  检查值是一个有效的信用卡号码· validateDate 检查值是一个有效的日期· validateDouble检查

1737

Struts Validator验证框架

validator验证框架Validator框架能够克服在ActionForm Bean中以编程方式进行数据验证的局限,它允许Struts应用灵活的配置验证规则,无需编程。Validator框架主要依赖两个JAR文件:jakarta-oro.jar和commons-validator,.jarValidator框架采用两个基于XML的配置文件来配置验证规则。这两个文件为validator-rule

Tom Studio (汤姆工作室) 914

使用 Struts Validator

本教程将指导您安装和配置 Struts Validator 组件。我将介绍如何使用 Validator —— 至少在一个简单的级别上使用 —— 并确保它能在具体的 Struts 配置中工作。而且,如果以前没有用过 Struts(但是却有足够的勇气跟随本教程),那么可以回顾 附录,里面提供了 Struts 安装的速成课程。完成本教程后,就设置并运行了 Validator,应当能够自如地把 Val

Bob@CSDN 1552

Struts Validator 实例

1    hello worldstruts-config.xmlxml version="1.0" encoding="UTF-8"?>DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.2//EN" "http://struts.apache.org/dtds

Vincent的造轮子经验 2527

Struts的验证--Validator

<span id="articlecontent" class="wenzhang_con" style="width: 780px;" onmouseup="function onmouseup(){NewHighlight(event)}">使用Validator包括如下三步:1、启用Validator插件;2、生成Form Bean类;3、修改配置文件。下面将详细说明如何配置和使

阳光下的立人 632

Struts 1 Validator框架学习笔记

为什么在没有Validator之前,用Actionform的validate()方法去验证用户输入的数据的方式不好?1. The Validator framework comesprepackaged with several validation routines, making the transition fromhard-coded validation logic

Kevin的专栏 887

Struts Validator 开发指南

使Struts支持Validator 要在Struts项目中使用Validator功能,首先需要配置Struts项目,使其支持Validator框架.Struts通过一个插件(Plugin)来使Struts项目支持Validator.这个Plugin由Struts默认提供,用户也可以自己开发自己的Validator Plugin.Struts默认提供的Plugin为:org.apach

580
上一篇: AppFuse介绍(转自铁手棋谱)
下一篇: 记事贴3:我被AppFuse的SiteMesh折磨了2天!
ltf_ty
博客等级 码龄25年 5粉丝 29原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值