struts DynaActionForm

struts-config :
  <?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE struts-config (View Source for full doctype...)>
- < struts-config >
- < form-beans >
- < form-bean name =" loginActionForm " type =" org.apache.struts.action.DynaActionForm ">
  < form-property name =" username " type =" java.lang.String " />
  < form-property name =" password " type =" java.lang.String " />
  </ form-bean >
  </ form-beans >
- < action-mappings >
- < action input =" /login.jsp " name =" loginActionForm " path =" /loginAction " scope =" request " type =" login.loginAction " validate =" false ">
  < forward name =" Success " path =" /main.jsp " />
  < forward name =" Fail " path =" /register.jsp " />
  </ action >
  </ action-mappings >
  </ struts-config >
web.xml:
  <?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE web-app (View Source for full doctype...)>
- < web-app >
- < servlet >
  < servlet-name > action </ servlet-name >
  < servlet-class > org.apache.struts.action.ActionServlet </ servlet-class >
- < init-param >
  < param-name > application </ param-name >
  < param-value > ApplicationResources </ param-value >
  </ init-param >
- < init-param >
  < param-name > config </ param-name >
  < param-value > /WEB-INF/struts-config.xml </ param-value >
  </ init-param >
- < init-param >
  < param-name > debug </ param-name >
  < param-value > 2 </ param-value >
  </ init-param >
  < load-on-startup > 2 </ load-on-startup >
  </ servlet >
- < servlet-mapping >
  < servlet-name > action </ servlet-name >
  < url-pattern > *.do </ url-pattern >
  </ servlet-mapping >
- < taglib >
  < taglib-uri > /WEB-INF/struts-bean.tld </ taglib-uri >
  < taglib-location > /WEB-INF/struts-bean.tld </ taglib-location >
  </ taglib >
- < taglib >
  < taglib-uri > /WEB-INF/struts-html.tld </ taglib-uri >
  < taglib-location > /WEB-INF/struts-html.tld </ taglib-location >
  </ taglib >
- < taglib >
  < taglib-uri > /WEB-INF/struts-logic.tld </ taglib-uri >
  < taglib-location > /WEB-INF/struts-logic.tld </ taglib-location >
  </ taglib >
- < taglib >
  < taglib-uri > /WEB-INF/struts-nested.tld </ taglib-uri >
  < taglib-location > /WEB-INF/struts-nested.tld </ taglib-location >
  </ taglib >
- < taglib >
  < taglib-uri > /WEB-INF/struts-template.tld </ taglib-uri >
  < taglib-location > /WEB-INF/struts-template.tld </ taglib-location >
  </ taglib >
- < taglib >
  < taglib-uri > /WEB-INF/struts-tiles.tld </ taglib-uri >
  < taglib-location > /WEB-INF/struts-tiles.tld </ taglib-location >
  </ taglib >
  </ web-app >
  <?xml version="1.0" encoding="iso-8859-1" ?>
  <!DOCTYPE form-validation (View Source for full doctype...)>
- < form-validation >
- < formset >
- < form name =" loginActionForm ">
- < field property =" username " depends =" required,minlength ">
  < arg0 key =" label.username " />
  < arg1 name =" minlength " key =" ${var:minlength} " resource =" false " position =" 1 " />
- < var >
  < var-name > minlength </ var-name >
  < var-value > 3 </ var-value >
  </ var >
  </ field >
- < field property =" password " depends =" required,minlength ">
  < arg0 key =" label.password " />
  < arg1 name =" minlength " key =" ${var:minlength} " resource =" false " position =" 1 " />
- < var >
  < var-name > minlength </ var-name >
  < var-value > 3 </ var-value >
  </ var >
  </ field >
  </ form >
  </ formset >
  </ form-validation >
 <?xml version="1.0" encoding="UTF-8" ?>
  <!DOCTYPE form-validation (View Source for full doctype...)>
- <!--
  $Header: /home/cvs/jakarta-struts/conf/share/validator-rules.xml,v 1.52 2004/07/25 12:00:20 niallp Exp $
  $Revision: 1.52 $
  $Date: 2004/07/25 12:00:20 $

   This file contains the default Struts Validator pluggable validator
   definitions.  It should be placed somewhere under /WEB-INF and
   referenced in the struts-config.xml under the plug-in element
   for the ValidatorPlugIn.

      <plug-in className="org.apache.struts.validator.ValidatorPlugIn">
        <set-property property="pathnames" value="/WEB-INF/validator-rules.xml,
                                                  /WEB-INF/validation.xml"/>
      </plug-in>

   These are the default error messages associated with
   each validator defined in this file.  They should be
   added to your projects ApplicationResources.properties
   file or you can associate new ones by modifying the
   pluggable validators msg attributes in this file.

   # Struts Validator Error Messages
   errors.required={0} is required.
   errors.minlength={0} can not be less than {1} characters.
   errors.maxlength={0} can not be greater than {1} characters.
   errors.invalid={0} is invalid.

   errors.byte={0} must be a byte.
   errors.short={0} must be a short.
   errors.integer={0} must be an integer.
   errors.long={0} must be a long.
   errors.float={0} must be a float.
   errors.double={0} must be a double.

   errors.date={0} is not a date.
   errors.range={0} is not in the range {1} through {2}.
   errors.creditcard={0} is an invalid credit card number.
   errors.email={0} is an invalid e-mail address.

   Note: Starting in Struts 1.2.0 the default javascript definitions have
         been consolidated to commons-validator. The default can be overridden
         by supplying a <javascript> element with a CDATA section, just as
         in struts 1.1.

  --> <script></script>
- < form-validation >
- < global >
  < validator name =" required " classname =" org.apache.struts.validator.FieldChecks " method =" validateRequired " methodParams =" java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest " msg =" errors.required " />
  < validator name =" requiredif " classname =" org.apache.struts.validator.FieldChecks " method =" validateRequiredIf " methodParams =" java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest " msg =" errors.required " />
  < validator name =" validwhen " msg =" errors.validwhen " classname =" org.apache.struts.validator.validwhen.ValidWhen " method =" validateValidWhen " methodParams =" java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, org.apache.commons.validator.Validator, javax.servlet.http.HttpServletRequest " />
  < validator name =" minlength " classname =" org.apache.struts.validator.FieldChecks " method =" validateMinLength " methodParams =" java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest " depends ="" msg =" errors.minlength " jsFunction =" org.apache.commons.validator.javascript.validateMinLength " />
  < validator name =" maxlength " classname =" org.apache.struts.validator.FieldChecks " method =" validateMaxLength " methodParams =" java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest " depends ="" msg =" errors.maxlength " jsFunction =" org.apache.commons.validator.javascript.validateMaxLength " />
  < validator name =" mask " classname =" org.apache.struts.validator.FieldChecks " method =" validateMask " methodParams =" java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest " depends ="" msg =" errors.invalid " />
  < validator name =" byte " classname =" org.apache.struts.validator.FieldChecks " method =" validateByte " methodParams =" java.lang.Object, org.apache.commons.validator.ValidatorAction, org.apache.commons.validator.Field, org.apache.struts.action.ActionErrors, javax.servlet.http.HttpServletRequest " depends ="" msg =" errors.byte " jsFunctionName =" ByteValidations " />
 

你可能感兴趣的:(JavaScript,apache,Web,struts,servlet)