j2ee都是远程调用,所以,应该很耗资源,如果在c--s间反复传输,不仅增加网络负荷也,太好资源。所以应该在client端做校验。这是最好的办法,也是必须的。
解决方案 »
- spring 定时任务中调用context 报异常NullPointer
- 跪求高手解答难题,在线等啊。。。。。。。。
- hibernate异常
- 在 Struts2+Spring3.0+hibernate3.6中怎么统计用户在线时间?
- Weblogic高手帮帮忙
- Java怎么提高导出大批量数据的效率
- java版本的搜索引擎demo,大家帮我找下,有好的demo推荐下,我周三就要交了,我对这块是很陌生啊!
- 可视化jsf 实现文件下载
- 我是Struts初学者,有些问题不解,望指点!
- 要用bean:write标签输出一个非bean的类的方法能行吗
- 我是初学者,在开发ejb中,请问update、add和delete 的操作 ,在session bean中直接写sql来updat、add、delete语句对库操作行吗?还是在e
- 关于在JBUILDER7下开发EJB的问题?
Client-side Scripting: Inflexible and Non-portable
Client-side data validation was the first generation of user input data validation technology for web applications. It is still widely used today. The data validation logic is typically implemented in HTML and Javascript and embedded in the Web pages transmitted to the browser. While it provides faster response time by reducing the number of round trips to the server, this approach has the following shortcomings:Successful data validation relies heavily on client-side configuration. An end user might choose to have Javascript disabled in her browser for security reasons or simply to avoid popup advertisements. Also, different browsers support subtly different feature sets of Javascript; it's often necessary to use different APIs in different browsers to do the same thing.
Complex data validation logic usually needs to access data stored on the server. For example, a client-side snippet of Javascript is able to check whether a ZIP code is well-formed, but a more sophisticated application would want to further validate the ZIP code by searching a ZIP code database stored on a Web or database server.
The data validation logic, an integral part of the business logic, is removed from the business layer and combined with the presentation layer. This violates the principles of three-tiered architecture, introducing unnecessary coupling that reduces flexibility.
请问一下lovevicky511(郭志军),在server端校验就足够了,为什么还要在client做呢?server client同时做的话不是一种重复和浪费吗?
这几天在网上搜了一些 form validation的资源,和大家分享,希望对大家有帮助
Form Validation on the Client Side
- 讲了基本的javascript form validation
http://www.webmasterbase.com/article/862Form Validation on Steroids
- 一个别人写的javascript form validation
http://jennifermadden.com/steroidVal/formDocumentation.htmlYet Another Article on Client Side Form Validation
- 用dom和输入框的待殊属性来进行校验
http://www.webmasterbase.com/article/661Advanced form processing using JSP
- javaworld.com上的一篇文章
http://www.javaworld.com/javaworld/jw-03-2000/jw-0331-ssj-forms.htmlHTML form processing, HTML form validation
- google新闻组上有人列出了一些form validation的资源
http://groups.google.com/groups?q=java+form+validation&hl=zh-CN&lr=&ie=UTF-8&oe=UTF-8&selm=tPyd9.200084%24aA.39457%40sccrnsc02&rnum=3
以下是它的内容
-------------------------------------------------------------------------------------
I would like to hear from others regarding techniques for
validating HTML form data in a web applicationI already found these resources:http://www.javaworld.com/javaworld/jw-04-2001/jw-0427-forms.html
Barracuda Form
Validatorhttp://barracuda.enhydra.org/cvs_source/Barracuda/docs/forms/high_l
evel_overview.html
http://formproc.sourceforge.net/ ( http://www.formproc.org/ )article: Java and XML: Learn a Better Approach To Data Validation
- 这篇讲得很好,讲了validation应该怎样做才是好的
http://www.devx.com/java/free/articles/schwartz0402/schwartz0402-1.aspWeblogic JSP form validation tags
http://edocs.bea.com/wls/docs70/jsp/validation_tags.htmlForm Processing API
http://www3.sympatico.ca/iostro/fpapi2.0/Validation JSP taglib
http://www.servletsuite.com/servlets/validtag.htmForm processing chapter in "Java Servlets by Example"
http://www.manning.com/Williamson/Contents.htmlStruts API: org.apache.struts.validator.action.ValidatorForm
http://jakarta.apache.org/struts/Jakarta Commons commons-validator
http://jakarta.apache.org/commons/components.html
article: Handling HTML Forms
http://java.sun.com/products/jsp/html/jspbasics.fm2.html
--------------------------------------------------------------------------------