Here are some archetype classes that the system uses. In adding new code, please keep using the appropriate responsibilities for each class type.
Each JSP uses exactly one Action class. These classes are the ones that integrate all of the other classes together to form the feature. For example, the Action class will take in parameters, validate the information, perform some “business logic” if needed, then pass the information over to the DAO for database interaction. Methods in Action classes can get pretty complex if you're not careful. Rule of thumb: if your method takes up more than a single screen, start splitting your method up into smaller methods. Plenty of Action classes delegate the logic to a separate set of classes (e.g. ChronicDiseaseMediator).
These are abstractions to provide some ease in making new actions. Use a base action when a page requires an ID of some sort to work. For example, “Edit Patient” would have to have a Patient ID in order to make sense. If you use a PatientBaseAction, then its constructor will verify the MID string and throw an exception if it doesn't check out (thus kicking you back to your homepage with an error message).
A bean's purpose is to store data. Period. Little or no functionality is to be added to a bean (with the exception of minor formatting such as concatenating phone numbers together). A bean must only have Getters and Setters (Eclipse Hint: Use Source > Generate Getters and Setters… to create these easily)
A form is a bean, kinda. You could say that it's a “form” of a bean :) Think of a form as a real-life administrative form that you would fill out to get something done, not necessarily making sense by itself. For example, a Patient is a Bean, but the info used to request an Epidemic Detection is a Form.
Loads in information to/from beans using ResultSets and PreparedStatements. Use the superclass to enforce consistency.
Checks a given bean for valid input. This is a must for input from the user! Note that Validators are designed around giving the user all of the errors in their form at once. For example, if the First Name AND the Last Name of a patient are wrong - the validator should report both problems, not just the first error and then stop.
Database Access Object. All info coming into a DAO is already validated. Just worry about DB stuff here. As a result, DAO methods should rarely have if-statements or perform any complex functionality other than storing to and retreiving from the database. If you think a DAO method requires a lot of complexity, consider the alternatives :
Also, note the following conventions:
Also, see the how do i page for more valuable information on DAOs and database conventions.