aspose file tools*
The moose likes Struts and the fly likes data transfer from action to biz service Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "data transfer from action to biz service" Watch "data transfer from action to biz service" New topic
Author

data transfer from action to biz service

Raj Bhandari
Ranch Hand

Joined: Oct 19, 2005
Posts: 97
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

Joined: Feb 03, 2004
Posts: 456
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

Joined: May 24, 2003
Posts: 425
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

Joined: Oct 19, 2005
Posts: 97
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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: data transfer from action to biz service