I'm a beginner for spring and jsf technology. I have a requirement to design web based leave management module using jsf and spring. Im confused in the design phase itself and not clearly knowing how to classify the classes. I need to understand clearly on how to do class design, and wanted to use MVC design patterns. As i know jsf itself is MVC but, as i want to use spring, i need to have some kind of model files and bean files.
I'm clear about the following 3 classes.
this will be like applicant will apply for leave and approvar when he logs he will see list of applied leaves and he will approve / reject the same by selecting one or more rows from datatable.
Please guide me on designing this or gimme some link where i can read about designing java classes for web based applications.
There's no one "right" way to do this. There are several layers of functionality that are common, but depending on circumstances, they may or may not require distinct sets of classes to implement. Some apps just don't deserve that much complexity.
At the outer level, of course, you have the MVC layer. At the bottom of the MVC layer you'll have backing beans, possibly assisted by some UI model beans. For example, I have an app that subclasses the JSF DataModel class and a set of façades for row data that assist in UI support for the domain model objects.
Next layer down would be the business logic. Depending on convenience, these could either be JSF managed beans that aren't backing beans or Spring Beans. Non-backing JSF managed beans are simply beans that no View directly references, but that get injected into other JSF managed beans. Whether you use JSF or Spring to manufacture them actually doesn't matter.
Down the next layer is the service layer. Most commonly that includes persistence services, but it can also include email, messaging, and other utilities as well. I do these as Spring beans. The service layer may have upper and lower tiers, as sometimes I provide abstract business-related services in the upper tier and low-level services invoked from the upper tier in the lower tier.
I don't actually have all that much use for SpringMVC myself. I usually use JSF.
An IDE is no substitute for an Intelligent Developer.
Joined: Oct 20, 2009
Thanks Tim Holloway for your reply. I could understand some of the things from your reply. But not very clear about the layers which you explained. Anyhow, if I read more i hope i can get cleared the things.
But is there any link where i can read myself and improve my class / application designing skills ?
You seems like very new to J2EE/JavaEE Web Application and distributed system, not just new to Spring and JSF. Do you understand JSP/Servlet ? JSF is built on top of that concept though not much different. MVC? Gateway Controller? Front Controller? Action Handler? View Handler? Page Controller? Incepting Filter? ...
If you really just want to know about architecture design of the Web Application, here is the book from APRESS titled "Pro Java EE Spring Pattern"
But, from what you mentioned, you seems like need 2 part of design
(1) Distributed System architecture design
(2) Business Logic design which involve Applicant, Approver, Leave which occur in different layer (presentation layer, service layer, integration layer)
Basically, if you are using JavaEE structure, Servlet Container holding objects of presentation layer, EJB Container holding the objects service layer and integration layer. Since you are planning to using Spring, basically objects are live in IOC Container (Application Context), thus the main difference is that JSF Managed Bean is managed by Spring IOC Container instead of Servlet Container.
SCJP 6, SCWCD 5, SCBCD 5
Joined: Oct 20, 2009
Thanks for your reply. And Yes, As you said, there is a long way to go. I understand the development of jsp & servlets and little bit understanding of design patterns too. I will read the book you suggested and try to understand the web architecture.