If I understand the question, all you have to do is change the form's
action to insert or update as the case may be. A good way to do this is
to have a "task" parameter that you would pass to a single action
designed to handle both cases. You can do this dymamically using (where
key=0 means we're inserting a new record).
<logic:equal name="myForm" property="key" value="0">
<input type="hidden" name="task" value="insert">
</logic:equal>
<logic:notEqual name="myForm" property="key" value="0">
<input type="hidden" name="task" value="update">
</logic:notEqual>
For an update, visit an Action first, select the record, populate the
form, and forward to input.
John Hogan wrote:
>
> All,
>
> I have a situation where it is desirable to use a form/page for both
> adding new info and editing existing data. The new info scenario is
> straight forward struts ActionForm/Action classes. What I'm
> wrestling with a bit is the edit scenario. I'm wondering if I can
> stay within the struts framework and still do something like entering
> a page in edit mode and have it displaying existing user data?
>
> It seems this should be possible because that's exactly what the page
> does for error handling. Has anyone else tackled this one yet? TIA.
>
> JohnH
>
> _____________________________________
>
> Get your free E-mail at http://www.ireland.com
-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/