• Post Reply Bookmark Topic Watch Topic
  • New Topic

Handling Presentation Layer  RSS feed

 
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Friends,

I have a design question in Spring 3.Here is the background..

1. Currently our project is using Spring Core,Spring MVC, EJB3 and JSP.

2. The persistent layer is through - JPA entities. We have used bottom up approach, as we have to create application using existing database,

3. The flow is like this
1. Dispatcher Servlet takes the request, passes the request to corresponding controller.

2. The controller uses the Service objects to interact with enterprise beans and create the business objects. Here business objects represent generic objects which are used across the application.

3. Value Objects are responsible for presentation layer. These objects have one to one mapping between the UI elements.

4. Mapper classes are responsible to map/fill the Value Objects from the result of Service Class calls.

5. We are creating value objects with one to one mapping of screen elements.These UI elements are the result of JPA entities. i.e., based on input from the UI, a disticnt object/row of an entity represent what to
display on the UI.

6. Currently, one UI screen contains the result of different entities. For example Employee screen contains Employee object, Employee expense details object and Employee Expense details object.
These object contains distinct elements.On top of it, Summary page contains diffent objects of these kind.

Question:-

My question is, if I create a corresponding VO for Employee, Expense, Employer, how to combine these objects. I mean, if I start creating VO's like this.. suppose if UI contains 10 different sections with 10 elements of each, data pulled from different tables, then I may end up creating a VO with 100 elements. So I felt creating VO for each section would make sense.

How to relate these VO objects from creation of VO to display in JSP. I can not come up with business objects for the sake of UI.
Is there any design pattern ?

Thanks,
Suresh.
 
Ranch Hand
Posts: 236
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to have one PO/VO for each UI page.
And one BO for each table for ORM.

You can do the mapping of BO to PO in controller.
 
Rancher
Posts: 2762
32
Eclipse IDE Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

kalle suresh wrote:
6. Currently, one UI screen contains the result of different entities. For example Employee screen contains Employee object, Employee expense details object and Employee Expense details object.
These object contains distinct elements.On top of it, Summary page contains diffent objects of these kind.



How do you display the Employee/Emplyee details and employee expenses. Is it all in one flat table, or do you show employees, and when the picks an employee, show the employee details/expenses?
 
kalle suresh
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Those are in three different tables. All these three sections/details are displayed under one page. Is there any best practice to perform this ? I looked into Composite View Design Pattern, but it looks like it handles only similar objects, not distinct objects.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!