You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Balkan Guler <ce...@gmail.com> on 2005/08/12 07:42:29 UTC
editing rows
Hello
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?
or are there any other approaches?
Re: editing rows
Posted by Laurie Harper <la...@holoweb.net>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org