Hello. I want to solicit some advice and opinions. Working on my first Struts app.

I have some use cases that call for typcial "add" and "update" functionality that basically can share the same forms. Obviously when the form is first displayed under "add" conditions, it needs to be blank. Under "update" conditions, the form needs to be prepopulated using the results of a DB select. In addition, a few fields that are present under "add" conditions no longer should be present under "update" conditions.

My current plan is to:

1) Use two different JSPs to house these forms, even though there will be a lot of redundancy, because the fields may have some variation, and because I'm not fond of having conditionals in the form (if (add) { } else { //must be update). I suppose the common block of fields could be refactored into an include. Any opinions on this are welcome.

2) Prepopulate the "update" form by assigning an action to it. I suppose the action would, in the execute method, call a business object, get a value object and use the attributes of this object to set all the fields of the ActionForm before returning a forward to the update form screen. Is this the right approach? I would especially like opinions here. My view screens have ".jsp" extensions but my screens that have submittable forms have actions that use path mapping, such as "foo/login" and "foo/register" and "foo/save", and so forth. Is it common to map viewing/prepopulating actions one way and saving/writing actions another?

I have heard of the use of the "reset" method in an Action for prepopulating a form, and indeed it looks convenient. I also have heard Struts developers may want to deprecate this method.

Any advice/opinions/links welcome.

Thanks,

Erik

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to