Of course, if you're happy to push all the data for each row out to the
browser in the page. Just include all the data for the row you want to edit
in the request to edit it and construct your edit page accordingly. You'll
still need a database hit to save the data, of course.
Bear in mind that since you're loading the rows to display them they may
well be in level 1 or level 2 cache (i.e. requesting the row for edit may
not actually require a database hit), depending on your persistence
technology. In that case, you may be better off sending the row ID and
querying for it, for consistency with pages where the amount of data
involved makes it inpractical to avoid this.
L.
Valiveti, Kalyan (KeyPeople Resources Inc.) wrote:
Laurie,
I am also looking into similar thing. Doesn't that call for an extra
database hit. What if the row contains all the possible values that are
to be displayed on the edit page? Is there a way I can just send the
entire row-object instead of the primary key/id?
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Laurie Harper
Sent: Friday, August 12, 2005 10:35 AM
To: user@struts.apache.org
Subject: Re: editing rows
Balkan Guler wrote:
There are some tables in database and I have to transfer them to the
web pages.
Also they can be deleted and edited.
I am using Struts.
I populate a list of objects from tables.
And put this list in a formbean
and list them in a web page as below:
<logic:iterate id="omenu" name="operForm" property="operMenus"> <tr>
<td> <bean:write name="omenu" property ="description"/></td> <td>
<bean:write name="omenu" property ="action"/></td> </tr>
</logic:iterate> I want to make all rows editable therefore I am
thinking of puting a
button(edit) at the end of all rows and if clicked show all details in
text boxes in a new popup.
the question is how can I recognize the clicked row and populate them
in a new window?
You'll need to include a row ID (preferably the primary key column from
the database, but anything that uniquely identifies the row is fine) as
a property in your form bean to use in the URL the 'edit' link submits.
If your table is already wrapped in a form, you can just add a button
(or an input of type 'submit') on each row, using the row ID as the
request parameter value for the button. If not, you can either add a
wrapping form, add a separate form on each row. Alternatively, use a
link instead of a button, which will work whether you have forms on the
page or not.
L.
--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie Founder,
Zotech Software: http://www.zotechsoftware.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
--
Laurie Harper
Open Source advocate, Java geek: http://www.holoweb.net/laurie
Founder, Zotech Software: http://www.zotechsoftware.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]