Struts is a framework for maintaining the presentation layer.. normally we ll
have to write the validation for the form elements that we use in a
javascript file but some browsers may not support it.. so wen we use struts
it wil do all the validation for us…

There are some important files to look for in struts

struts-config.xml
validation.xml
validator-rules.xml

these are the configuration files.. other than these we ll have the form
beans, action classes and all that…

i ll jus explain briefly about these…

struts-config.xml is the main file of ur application… there wil be one
thing called action mapping attribute in that xml file… it wil map the
action terms with the corresponding action class… the action classes are
nothing but the servlets that we normally write… the jsp file will be
mentioning the action terms to cal these servlets, here called action
classes…

before calling these action classes the struts config wil cal the validator
and validation-rules xml files and validates the fields that are mentioned
in the validator.xml file… we ll also have a properties file which wil have
the key value mapping for the errors.. we ve to jus specify wat are the
fields that need validation and wat type of validation like it must be only
number or it is required field like that….

so wen the validator comes across any errors it wil jus throw the error that
we ve mentioned… the main advantage is that only the specific field value
wil be erased other field values wil be maintained so tat u need not enter
the values once again… this is the main advantage …

so after the validation it goes to the specific action classes after which
the process is siminlar to a servlet-jsp calling…

another main advantage of using struts is that it wil not reveal the name of
the servlet it is calling… it wil be having a common url for all the
pages….

this is the main theme of struts… if u want some thing specific let me
know…

Advertisements