Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

data transfer from action to biz service

 
Raj Bhandari
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Experts,

I have a question regarding passing data from action to business service. Please let me know the good practice.

1) Is my assumption correct that the action form (formbean) for the ui layer should be a flat structure like following:


Or it can be in this format too:


Which is a good/recommended practice ?

Note - Edited message to be short and crisp 09/25/2006
[ September 25, 2006: Message edited by: Raj Bhandari ]
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello,

just to the first part of your question.

no, you are not correct with you assumption. as long as objects follow the bean-convention, you will not have any problems accessing them like this

user.address.street

(which works with a form which has a user who has an adress which has a street, which is a String)

all of them accessible through getters.

i see no reason why you would flatten this structure, this just creates artificial overhead and doubles code.

hope this clearifies,
jan
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I prefer to use flat version for couple of reason

- It's common pratice to use String members in action form
- I don't think having VO's will help if we make very member as String
- If form is big then we will endup with more objects than required.
- What if most of the fields in the forms aren't mandatory?

Is there any real pro's in using hierarchy version? I would be interested in knowing them.
 
Raj Bhandari
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jan, thanks for the reply.
Also Purushothaman, I agree with you because thats how I used to do but now the form I have to create consists of 100+ fields. So, I'm thinking of using a hierarchial structure so that I can include the BO into the actionform(formbean) directly. This way I won't have to do the mapping also.
Note - I think Jan answered the fact that we can use hierarchial structure within the actionform.. i'm adding another twist (or bad practice ?? i'm asking for a POJO application where we ourselve's maintain the presentation?) by using a BO directly instead.
[ September 26, 2006: Message edited by: Raj Bhandari ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic