While going through the 2 articles trying to get this stuff down, I noticed that we are going to use a DynaBean in struts 1.1 so that we aren't creating form beans for every single form. I like that. Howerver, the LoginAction class instantiates the LoginBean class from the 1.0 article. It is my understanding that the DynaBean is replacing that LoginBean? Am I incorrect in saying this? Do we still need the LoginBean? If not, what happens in the LoginAction?
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
The LoginBean is used by the MainMenu.jsp. See this line: <jsp:useBean id="LoginBean" scope="request" class="test.struts.LoginBean" />
Ok, so with the above being said... It is my understanding that using dynamic beans saves the time of creating a Form Bean with a bunch of getter and setter methods for every single form you have. So if that is the case, what happens when another form needs access to that data written to the dynamic bean? For example, wouldn't you want MainMenu to have access to this Dynamic Bean? Instead of creating the bean anyway? I guess I am confused. I guess what I am saying is why use a dynamic bean and still create the form bean manually?
Thomas Paul
mister krabs
Ranch Hand
Joined: May 05, 2000
Posts: 13974
posted
0
We are talking about two different roles here. The dynamic form validation does very basic field validation. The LoginBean is doing complex business rule validation. This is normally how you would code validations. Front end validation checks to make sure that date fields have valid dates and numeric fields have valid numerics, etc. Then you do complex validation such as is the SSN in your database, is the user permitted to do this function. In our example, the dynamic form validation checks that required fields are entered and are of the minimum required size. The LoginBean checks to make sure that the user id and password are valid. This would be where you might check with a database or LDAP.
Originally posted by Thomas Paul: We are talking about two different roles here. The dynamic form validation does very basic field validation. The LoginBean is doing complex business rule validation. This is normally how you would code validations. Front end validation checks to make sure that date fields have valid dates and numeric fields have valid numerics, etc. Then you do complex validation such as is the SSN in your database, is the user permitted to do this function. In our example, the dynamic form validation checks that required fields are entered and are of the minimum required size. The LoginBean checks to make sure that the user id and password are valid. This would be where you might check with a database or LDAP.
Ahh, great! Thanks.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.