• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts Design Problem

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all,
I have to design a Struts application. In this I have to do 2 types of validations(for a login form):
1) To check whether a field is empty or not.
2) To check whether the user and password match or not.
Now, as far as I understand Struts, for the first type of validation I should use "validate" method of the ActionForm, and, for the second type of the validation, I should use the "execute" method and redirect the user to a different JSP page if the login is invalid.
Now using "validate" method is a server-side validation and the validations inside a "execute" method is also a server-side validation. So if I validate the username and the password in the "validate" method, is it right? If not what difference will it make in case of implementation as well as design. Please clear the difference between validating in a ActionForm and in a Action class. I am very confused in it.
Thanks in Advance
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The form's validate is meant for basic validation like if the fields were left blank or if two password fields match each other.
The execute of the action (if it contains any validation at all) should be more business oriented validation, such as if the username and password matched or that a credit card passed authentication. The logic for these types of validation should be delegated to other objects anyway.
 
reply
    Bookmark Topic Watch Topic
  • New Topic