Chinaunix首页 | 论坛 | 博客
  • 博客访问: 29945502
  • 博文数量: 708
  • 博客积分: 12163
  • 博客等级: 上将
  • 技术积分: 8240
  • 用 户 组: 普通用户
  • 注册时间: 2007-12-04 20:59
文章分类

全部博文(708)

分类: Java

2008-04-18 16:27:39

------------struts-config.xml



 
 
   
     
     
   

 

 
 
 
          attribute="loginForm"
      input="/login.jsp"
      name="loginForm"
      path="/login"
      scope="request"
      type="org.zhym.struts.action.LoginAction" />

 

 

--------------------加入插件,加载两个配置文件
 
   
 

--------------------/WEB-INF/validation.xml,/WEB-INF/validator-rules.xml(自动生成)




 
  


   
    
    
    
     minlength
     5
    

   

   
    
    
    
     minlength
     5
    

   

  

 

--------------------------ApplicationResources

# Resources for parameter 'org.zhym.struts.ApplicationResources'
# Project Struts1.2
label.username=username
label.password=password
errors.required={0} is required.
errors.minlength={0} can not be less than {1} characters.

----------------------------login.jsp

<%@ page language="java" pageEncoding="ISO-8859-1"%>
<%@ taglib uri="" prefix="bean"%>
<%@ taglib uri="" prefix="html"%>
 

 
  JSP for DynaValidatorForm form
 
 
  
   password :

   username :

   
  

  
 

阅读(2121) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

qbq2008-11-17 11:29:56

不需要写 页面生成时 validate框架会在需要验证的页面中生成javascript验证代码 在login.jsp中有这个需要注意: onsubmit="return validateLoginForm(this)"> 这个就是提交的时候调用验证

chinaunix网友2008-11-14 21:57:51

validate="true" 都不写 抄别人点东西 自己也要验证下啊