The moose likes Struts and the fly likes Question About STRUTS Newsletter Article Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Reply Bookmark "Question About STRUTS Newsletter Article" Watch "Question About STRUTS Newsletter Article" New topic
Author

Question About STRUTS Newsletter Article

Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15229

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
The LoginBean is used by the MainMenu.jsp. See this line:
<jsp:useBean id="LoginBean" scope="request" class="test.struts.LoginBean" />


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15229

Ok, I see that now.
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15229

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
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.
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15229

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.
 
subject: Question About STRUTS Newsletter Article
 
Similar Threads
LazyValidatorForm and Lazy DynaBean
Struts 1.1 by Paul Thomas : how to compile LoginAction
struts (03/02 newsletter) LoginAction.java err
blank page - Action is not called
Help Needed