Hi,
I can almost guarantee there a lot of people in the same boat I am in so hopefully this post isn't too off topic, since I'm not so sure it's
j2ee per se.
I'm looking where to turn next for 'next step' resources. I don't think I'm probably the only one sort of stuck in the situation I am in. The situation is I want to make sure that I'm designing my web applications in a proper J2EE compliant design fashion, but not using EJBs and probably a lot of the other components that are involved with J2EE (maybe then I'm not asking about J2EE
. I know there is a lot more to do with J2EE than EJBs, but I'm finding the literature out there very overwhelming in a technical sense. I'm not a complete newbie, I've been coding with
JSP for about 3 years now, currently using
Struts for my front end and controller architecture and did finally get that Sun programmer's
test out of the way. I think I have a pretty good grasp of separating out the presentation from the business logic with MVC, but where I'm finding the most difficulty is trying to determine the best way to architect my business layer and how it should talk to the database through
JDBC. As I look for resources into these issues the biggest problem I'm running into is finding concrete examples of the design
patterns. Sure there is the pet store app but that's way overkill for the simple stuff I want to accomplish. Then on the other side most of the JSP books seem to barely touch on how your
servlets should talk to a business layer and then from there access the database. I hear so much about using DAOs, but then when I try to search on finding out how these are coded I never can find concrete examples of how these are implemented, or if there are concrete examples they seem to deal solely with EJBs.
Sorry for this long post, but I'm getting a bit frustrated as to where to turn next. I know I need to read up on design patterns. I haven't read Gang Of Four yet, so I know I need to hit that up plus learn as much as I can about other patterns (So any books with concrete examples anyone can recommend, I'll check them out.). Simon, I saw what you mentioned in this post
https://coderanch.com/t/309554/EJB-JEE/java/Design-Pettern and I've looked over the Sun J2EE link you provided on that post, but I was looking for some more depth of the patterns that have some concrete examples (Maybe I'm just stupid but I'll be honest I have a tough time following what they are talking about there without seeing some actual code). While I start reading some good material that hopefully others will recommend (that aren't too EJB heavy), maybe someone can give me some concrete feedback on how to best have my servlets talk to some business layer which in turn talks to the database.
Let me first explain how I currently have my JSP architecture set up, which I know probably isn't the best. Let's take a watered down example of doing an Update Employee application..
1) front end JSP form (using Struts all the fields are also tied to an underlying EmployeeForm bean.
2) JSP submits to a custom EmployeeUpdateAction class
3) In the EmployeeUpdateAction I might have a method ..
EmployeeBusinessObject.updateEmployee( EmployeeForm f )
4) the updateEmployee( EmployeeForm f ) in EmployeeBusinessObject doesn't do a lot in this case but get the appropriate
String parameters from the EmployeeForm bean and create an EmployeeBean out of the form, then it would call a method like
EmployeeRepository.updateEmployeeRecord( EmployeeBean e )
(Other stuff might potentially be called in this business layer besides just the above updateEmployeeRecord, but in this example it doesn't do much.)
5) EmployeeRepository I guess is sort of like a wimpy DAO. It has all the SQL and jdbc calls to do the updates, inserts, gets etc. In this example it has updateEmployeeRecord( EmployeeBean e ) but it would also have methods like Collection getEmployeeRecords() which would return a collection of EmployeeBeans. I'm guessing this level of abstraction here isn't good enough. I see some examples where they are returning cached Row sets and all kinds of other things so I'm guessing what I am doing is too simple and not OO enough, so I'd really like some pointers in this regard.
Any advice on what I should start reading to make sure I'm doing things the right way would be much appreciated. Sorry if this post was OT for this forum. Feel free to move it or repost it to a more appropriate one if need be.
Thanks so much,
confused where to go next,
Rick