An ActionForm class contains a field that has not been declared private, which can be accessed without using a setter or getter.
N/A
Threat Mapped score: 0.0
Industry: Finiancial
Threat priority: Unclassified
N/A
N/A
Phase | Note |
---|---|
Implementation | N/A |
Intro: In the following Java example the class RegistrationForm is a Struts framework ActionForm Bean that will maintain user input data from a registration webpage for a online business site. The user will enter registration data and through the Struts framework the RegistrationForm bean will maintain the user data.
Body: However, within the RegistrationForm the member variables for the registration form input data are declared public not private. All member variables within a Struts framework ActionForm class must be declared private to prevent the member variables from being modified without using the getter and setter methods. The following example shows the member variables being declared private and getter and setter methods declared for accessing the member variables.
public class RegistrationForm extends org.apache.struts.validator.ValidatorForm { // variables for registration form public String name; public String email; ... public RegistrationForm() { super(); } public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {...} ... }