Hi Martin,

The important link here is the key for your row (row.id). Establish a way to pass that to your edit page, via a hidden field, for example, and that's really it.

Recall (Struts 101) that we preface all pages (JSPs) with actions. ... so your action can take the ID value that was submitted to it and lookup that particular row, which it'll populate a form bean for and then forward to your JSP page. Your page just lays the data out. Then, your save button will cause an action to be invoked that will save the row to the database.

I've taken to using the LookupDispatchAction quite a bit. By doing so, I can lower the number of classes I have running around, and also provide a mechanism for internationalization, based on Locale. It can be cumbersome to get your head around at first, but it's well worth the effort to learn. If you were to do this, you could easily build a single action that would handle your display, edit, save, delete functionality for each type of "row" you have (one action class per "row type").

Generally, my "list" pages will generate links that, when clicked on, will cause the edit page to "pop-up". The link is nothing but a link to my edit action that passes along important parameters, like that ID value, and perhaps a parameter indicating which method to invoke (if you're using the LookupDispatchAction approach).

Is that clear as mud?

Good Luck!

Eddie

----- Original Message ----- From: "Martin Stahovec" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Friday, May 27, 2005 4:20 PM
Subject: editing rows


Hi guys;
(one more time)
I'm new to struts and I just learn how to use it.I'm working on my first struts app and have following problem: I don't know, how to edit rows in my jsp. On the first jsp(Form.jsp) I have just the table, taht consists of the columns ID, CURR, NAME, START and buttons DELETE and EDIT. When I click EDIT button, I want to open FormEdit.jsp with ID-text field, CURR-listOfValue, NAME-text field, START-text field with the values from the selected row in the first jsp. At the bottom there is a SAVE button. Can anybody tell me, how can I do this........remember I'm new to struts :-) Thanks



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 0521-4, 05/27/2005
Tested on: 5/28/2005 11:57:36 AM
avast! - copyright (c) 2000-2004 ALWIL Software.
http://www.avast.com




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

Reply via email to