struts-config :
xml version="1.0" encoding="UTF-8" ?>
(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" ?>
(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" ?>
(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" ?>
(View Source for full doctype...)>
-
-
<
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
" />