Hi, > I agree with Eddie and Martin that this is probably not a good idea, but > for a different reason -- it would violate the layering of the MVC model. > > Remember that form beans are part of the View tier. Adding a prepare() > method for the purposes you propose would typically involve interacting > with the model (getting stuff from the database, applying business rules > to decide what information to display, and so on. That kind of thing > should really be done via an Action, which is why Struts encourages the > current approach. > > > -- > > Martin Cooper > > Craig
I partly agree with you. I agree that forms should be inside the View tier, but IMHO the methods "reset" and "validate" are methods of business/controller logic. Ideally i have our webdesigners create all the forms as _very_ simple beans (just some getters and setters). wether the the received input is valid shouldnt be decided/checked by them instead i (controller) should do it. For example if i look at the current implementation of the struts-example.war I find an issue that should point out what i mean. If u take RegistrationForm.java and SaveRegistrationAction.java for example the forms "validate" method does a simple check wether both entered passwords match. now later in the Action there are some more tests (username unique, etc) and perhaps another ActionErrors instance is created. We now did a form-validate (Form) and the action again does some "kind-of" form-validation. maybe my suggested "prepare" method and the "reset", "validate" method would fit better into the "Action" class as "prepareForm", "resetForm", "validateForm". Thomas -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>