关注,我这两天也卡在这了。
哪位给个简单点的例子,比如只验证一个text文本框的长度。
validator,和jsp最好都写出来
哪位给个简单点的例子,比如只验证一个text文本框的长度。
validator,和jsp最好都写出来
解决方案 »
- JAVA获取flash某一帧的图片
- spring 2.5的问题 顺便散分
- tomcat 6.0.14使用内存配置 如何合理分配
- java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type [javax.sql.DataSource]
- java 数值字符类型转换问题
- Spring+hibernate+struts程序为什么运行一段时间后就报"java.lang.OutOfMemoryError: Java heap space"错?
- Struts数据源配置问题
- tomcat报错org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
- 在Eclipse中开发Struts
- 200分 使用apache.org common项目中遇到的问题,怎样在apache.org里面提问
- struts1.2客户端验证的问题,确是没分了!
- TOMCAT5.0中,我在自己建的虚拟目录下能成功运行JSP程序,但为什么运行servlet程序时却报错呢?
package hello;import javax.servlet.http.HttpServletRequest;import org.apache.commons.validator.GenericValidator;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;import org.apache.struts.action.ActionErrors;import org.apache.struts.action.ActionForm;import org.apache.struts.action.ActionMapping;public final class HelloForm extends ActionForm { private String userName = null; public String getUserName() { return (this.userName); } public void setUserName(String userName) { this.userName = userName; } /** * Reset all properties to their default values. */ public void reset(ActionMapping mapping, HttpServletRequest request) { this.userName = null; } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) { ActionErrors errors = new ActionErrors(); if ((userName == null) || (userName.length() < 1)) errors.add("username", new ActionMessage("hello.no.username.error"));
/* if(!GenericValidator.isEmail(userName)) {
errors.add("username", new ActionMessage("hello.no.email"));
}
*Validator验证框架包含许多验证方法
*/ return errors; }}
谢谢了