You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by em...@cstone.net on 2003/05/28 04:48:12 UTC

Basic CRUD

I am putting together a simple web app that performs CRUD operations on a
database table.  The web app consists of 1 jsp page which handles all CRUD
actions.  The first part of the page contains a form with 2 fields and
'create' and 'retrieve' buttons.  Both these functions work fine.  When a
'retrieve' (select id,field1,field2 from table1) is done, a table is
rendered with the resultset on the same page.  For each record of the
recordset, there exists an 'update' and 'delete' button.  The problem is
how do I tell my action class which record to act on?

class MyFormBean extends ActionForm {
   private MyBean myBean;
   private ArrayList myBeanList;
}

class MyBean {
   private Long id;
   private String field1;
   private String field2;
}


The idea is to manage this 1 particular db table from a single view with a
single action class extended from LookupDispatchAction.  I've tried
several ways with no success.  I've tried using 1 form that includes
everything.  I've tried using a form for each record.  I've tried using
the nested taglib.  I believe this is view/jsp/taglib problem since the
actions are firing correctly.  How can I populate 'myBean' with the data
of the corresponding record from which the 'update' or 'delete' buttons
were clicked?

I prefer not to use checkboxes with a global 'update' and 'delete' button.
 I prefer not to use javascript (I'm not a big fan of this scripting
language and only use it when absolutely necessary, which is rare).  I
prefer not to go to a second page to "edit".

Can this be done exclusively within Struts?

Thanks in advance.
-Eric


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org