Why not put the ID as a hidden field on the form too, so you SAVE action can 
read it from the request and update the record with the ID ? It's not hard at 
all.

J


On Mon, 12 Sep 2005 13:48:45 +1000
"Murray Collingwood" <[EMAIL PROTECTED]> wrote:

> Hi folks
> 
> Getting back to some operational questions...
> 
> I want to edit some fields on a record in my database.  I have a form bean 
> which 
> contains all of these fields plus a bunch of other fields that I won't be 
> needing on the 
> edit form.  One of the fields I don't update is the ID property, it is my 
> PRIMARY KEY 
> and shouldn't be edited.
> 
> So I create my DataEditForm action, my DataEdit.jsp and my DataEditSave 
> action.
> 
> DataEditForm action retrieves the record (by ID, say "27") from the database 
> and 
> populates my form bean, saving it as a request attribute.
> 
> DataEdit.jsp displays just one text field from this bean (the current value 
> of the field is 
> displayed in this textbox) and I can edit it quite normally.
> 
> DataEditSave action receives the form after editing but fails to update the 
> record as the 
> ID value now reflects "0" instead of "27".
> 
> It seems to me that my DataEdit.jsp is dealing with 2 form beans, a pre-edit 
> version that 
> contains all of the data and a post-edit version that only contains the 
> information from 
> the html form.
> 
> I know I could create "html:hidden" tags for all of the other fields, however 
> this does 
> seem a little arcane.  I'm wondering if there is another option such as the 
> form bean 
> being saved pre-edit and restored post-edit and the fields from the html form 
> then being 
> updated again my form bean before being passed to my DataEditSave action?  
> This 
> would allow all of the unused fields to retain their true values.
> 
> I guess pushing the form bean into the session would do this, but session 
> variables for a 
> request level function is probably not recommended.
> 
> Looking forward to learning...
> 
> Kind regards
> mc
> 
> 
> FOCUS Computing
> Mob: 0415 24 26 24
> [EMAIL PROTECTED]
> http://www.focus-computing.com.au
> 
> 
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.344 / Virus Database: 267.10.21/96 - Release Date: 10/09/2005
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

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

Reply via email to