File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes advice on design is needed Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "advice on design is needed" Watch "advice on design is needed" New topic

advice on design is needed

Svetlana Koshkina
Ranch Hand

Joined: Jul 08, 2003
Posts: 108
Hi, guys!
For last two days I am trying to figure out how to implement one functionallity in struts. It would be great if you could help me out just a little bit.
I need to fill out protocol form. There are some easy fields such as title, version, authors etc. Those fit in a single page.
What troubles me is the protocol's body.
To support at least minimal formatting I decided to divide the body into
'subtitle' and 'subbody' pairs. There are theoretically should be no limits to how many of those will be in a protocol. This part can go on multiple pages.
The idea is that the user fills first page (title, authors etc), press 'continue' button and 'subtitle-subbody' textarea appears. After filling those out the user has two possibilities: by pressing 'continue' button he/she is getting next 'subtitle-subbody' page, by pressing 'Save', he/she submits this form and it goes to db in xml format so that when i want to present the protocol, i have hooks for necessary formatting.
I can't formulate the design clearly. I understand that I need one underlying bean that will be filled from the form and sent to the db. But how many forms should i have:
1. Should 'subtitle-subbody' section be as a separate form? So that I do not have limits on how many times the user pressess 'continue' button.
2. Or should i have one big form, but how i can implement unboundness of 'subtitle-subbody' part?
3. Probably in lights of having at least two diff. buttons i need LookupDispatchAction?
Any advice will be greatly appreciated.
The thing is that i have no experience and nobody to ask to. I was thinking that maybe there is just more or less tested and routine way of doing such things. I'm afraid that anything i come up with may be clumsy and amateurish.
Junilu Lacar

Joined: Feb 26, 2001
Posts: 6529

Sounds to me like the subtitle-subbody portions need to be backed by an indexed property. See these links: for more info

Junilu - [How to Ask Questions] [How to Answer Questions]
Svetlana Koshkina
Ranch Hand

Joined: Jul 08, 2003
Posts: 108
Sure, it is not a problem, although it cannot be done in a form bean.
I looked at some suggestions on the web. It is said that it's better to have single form bean on multiple pages, but then i have to make fixed quantity of subtitle-subbody, and in order it is being sufficient most of the times it have to be fairly big, say 15-20. DynaForms are better, but still, you have to declare them in struts-config.
I decided to split form on general part and sub-part. Sub-part will be indexed in backing bean. I see that i will be able to traverse the bean easily back and forth by keeping track of the views.
I agree. Here's the link:
subject: advice on design is needed
It's not a secret anymore!