易截截图软件、单文件、免安装、纯绿色、仅160KB

Client Side JavaScript Validation

Struts Validator Framework provides an easy-to-use mechanism for performing client-side validation. It's very useful to validate some fields on the client-side before sending the data to the server for processing. By this way we can ensure that the data send to the server is valid. Performing validations on the client-side save the user a round trip time to the server.
For each validation routine defined in the validation-rules.xml file Struts provides an optional JavaScript code that can run on the client-side to perform the same validation that takes place on the server side.
Let's take a login application for our example. Our LoginForm extends DynaValidatorForm.
1.
2.
3.
4.
The following validations are defined in the validation.xml file.
01.
02.
03.
04.
05.
06.
07.
08.
09. minlength
10. 6
11.
12.
13.
To enable client-side validation you have to place the Struts HTML Tag Library's javascript tag in each jsp page for which you need to preform client-side validation.
01.
02.
03.
04.JS Validation
05.
06.
07. >
08.
09. User Name :

10. Password :

11.
12.
13.
14.
The formName property of the javascript tag hold the name of the form specified in the validation.xml file.
Next step is to specify the onsubmit attribute of the HTML Tag Library's form tag. The onsubmit attribute is used to specify the javascript code that should be executed when the form is submitted.
The name of the validate method generated by the javascipt tag is formed by concatenating "validate" with the name of the form specified in the javascript. For example, our form name is "LoginForm" so the generated method name will be "validateLoginForm". If the form name is "loginForm", the generated method name will be "validateLoginForm"
Run the application. The login.jsp page will be displayed. Click the login button without entering t


相关文档:

最近自己在写javascript/html/css的树控件

    完成以下部分:
    1. 树可以接受singleXml格式和json以及jsonarray格式的数据;
    2. 复选框勾选和折叠子节点的逻辑用div嵌套来实现,效率更高;并提供了快速画树的方法;(存在bug:快速画树效率并不高,div嵌套有问题);
    3.增加树的深度 this.depth ......

Javascript操作Select和Option

注意:Option中的O是要大写的,不然语法报错
1.动态创建select
      function createSelect(){
        var mySelect = document.createElement("select");
          mySelect.id = "mySelect";  ......

Javascript 闭包


翻译:为之漫笔
链接:http://www.cn-cuckoo.com/2007/08/01/understand-javascript-closures-72.html
简介
基于对象的属性名解析
值的指定
值的读取
标识符解析、执行环境和作用域链
执行环境
作用域链与 [[scope]]
标识符解析
闭包
自动垃圾收集
构成闭包
通过闭包可以做什么?
例 1:为函数 ......

javascript中iframe里面的页面调用父窗口js函数的方法

声明:本文系JavaEye网站发布的原创博客文章,未经作者书面许可,严禁任何网站转载本文,否则必将追究法律责任!
实现iframe内部页面直接调用该iframe所属父窗口自定义函数的方法。
比如有A窗口,A内有个IFRAME. B,B里面的装载的是C页面,这时C要直接调用A里面的一个自定义函数ExpandPage();
那么只要在C页面中写如下J ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号