Problem in deleting a row

hi,
I have a table with set of values.  added three buttons below that in table. add row, delete row, save.
if I delete the row and save and if i come again to that application still that deleted row remains. what might be the problem?

you can use flag in your internal table,
when you press delete button after selecting the particular row, set the flag for this entry in itab.
now in save event loop through the table checking flag, and delete enteries. now bind the table again by the itab.
you can do the same thing in delete button event also,
if not solved, please explain more
Yogesh N

Similar Messages

  • Problem of deletion of rows in jtable, table refreshing too

    Hi,
    I have a table with empty rows in the beginning with some custom properties( columns have fixed width...), later user would be adding to the rows to this table and can delete, I've a problem while deleting the rows from table,
    When a selected row is deleted the model is also deleting the data but the table(view) is not refreshed.
    Actually i'm selecting a cell of a row, then hitting the delete button.
    So the model is deleting the information, but i'm not able to c the fresh data in table( especially when the last cell of last row is selectd and hit the delete button, i am getting lots of exception)
    Kindly copy the below code and execute it, and let me know,
    * AuditPanel.java
    * Created on August 30, 2002, 3:05 AM
    import javax.swing.*;
    import java.awt.*;
    import javax.swing.table.*;
    import java.awt.event.*;
    import javax.swing.event.*;
    import java.util.Vector;
    * @author yaman
    public class AuditPanel extends javax.swing.JPanel {
    // These are the combobox values
    private String[] acceptenceOptions;
    private Vector colNames;
    private Color rowSelectionBackground = Color.yellow;
    private int rowHeight = 20;
    private int column0Width =70;
    private int column1Width =96;
    private int column2Width =327;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    /** Creates new form AuditPanel */
    public AuditPanel() {
    public void renderPanel(){
    initComponents();
    public String[] getAcceptenceOptions(){
    return acceptenceOptions;
    public void setAcceptenceOptions(String[] acceptenceOptions){
    this.acceptenceOptions = acceptenceOptions;
    public Vector getColumnNames(){
    return colNames;
    public void setColumnNames(Vector colNames){
    this.colNames = colNames;
    public Vector getData(){
    Vector dataVector = new Vector();
    /*dataVector.add(null);
    dataVector.add(null);
    dataVector.add(null);
    return dataVector;
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    jPanel2 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    jPanel1 = new javax.swing.JPanel();
    jTable1 = new javax.swing.JTable();
    setLayout(new java.awt.GridBagLayout());
    setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
    jPanel2.setLayout(new java.awt.GridBagLayout());
    jPanel2.setBorder(new javax.swing.border.EmptyBorder(0,0,0,0));
    jButton1.setText("Add");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.ipadx = 8;
    gridBagConstraints.insets = new java.awt.Insets(0, 1, 5, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    jPanel2.add(jButton1, gridBagConstraints);
    jButton2.setText("Delete");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
    jPanel2.add(jButton2, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    add(jPanel2, gridBagConstraints);
    jPanel1.setLayout(new java.awt.GridBagLayout());
    jPanel1.setBorder(new javax.swing.border.BevelBorder(javax.swing.border.BevelBorder.LOWERED, Color.black, Color.gray) );
    jTable1.setModel(new javax.swing.table.DefaultTableModel(getData(), getColumnNames()));
    // get all the columns and set the column required properties
    java.util.Enumeration enum = jTable1.getColumnModel().getColumns();
    while (enum.hasMoreElements()) {
    TableColumn column = (TableColumn)enum.nextElement();
    if( column.getModelIndex() == 0 ) {
    column.setPreferredWidth(column0Width);
    column.setCellEditor( new ValidateCellDataEditor(true) );
    if( column.getModelIndex() == 1) {
    column.setPreferredWidth(column1Width);
    column.setCellEditor(new AcceptenceComboBoxEditor(getAcceptenceOptions()));
    // If the cell should appear like a combobox in its
    // non-editing state, also set the combobox renderer
    //column.setCellRenderer(new AcceptenceComboBoxRenderer(getAcceptenceOptions()));
    if( column.getModelIndex() == 2 ) {
    column.setPreferredWidth(column2Width); // width of column
    column.setCellEditor( new ValidateCellDataEditor(false) );
    jScrollPane1 = new javax.swing.JScrollPane(jTable1);
    jScrollPane1.setPreferredSize(new java.awt.Dimension(480, 280));
    jTable1.setMinimumSize(new java.awt.Dimension(60, 70));
    //jTable1.setPreferredSize(new java.awt.Dimension(300, 70));
    //jScrollPane1.setViewportView(jTable1);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTH;
    jPanel1.add(jScrollPane1, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    add(jPanel1, gridBagConstraints);
    // set the row height
    jTable1.setRowHeight(rowHeight);
    // set selection color
    jTable1.setSelectionBackground(rowSelectionBackground);
    // set the single selection
    jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    // avoid table header to resize/ rearrange
    jTable1.getTableHeader().setReorderingAllowed(false);
    jTable1.getTableHeader().setResizingAllowed(false);
    // Table header font
    jTable1.getTableHeader().setFont( new Font( jTable1.getFont().getName(),Font.BOLD,jTable1.getFont().getSize() ) );
    jButton1.setMnemonic(KeyEvent.VK_A);
    // action of add button
    jButton1.addActionListener( new ActionListener(){
    public void actionPerformed(ActionEvent actionEvent){
    // If a button press is the trigger to leave a JTable cell and save the data in model
    if(jTable1.isEditing() ){
    //System.out.println("table is edition ");
    String text=((javax.swing.text.JTextComponent)jTable1.getEditorComponent()).getText();
    jTable1.setValueAt(text,jTable1.getSelectedRow(),jTable1.getSelectedColumn()) ;
    jTable1.getCellEditor().cancelCellEditing();
    // find out total available rows
    int totalRows = jTable1.getRowCount();
    int cols = jTable1.getModel().getColumnCount();
    if( jTable1.getModel() instanceof DefaultTableModel ) {
    ((DefaultTableModel)jTable1.getModel()).addRow(new Object[cols]);
    int newRowCount = jTable1.getRowCount();
    // select the first row
    jTable1.getSelectionModel().setSelectionInterval(newRowCount-1,newRowCount-1);
    jButton2.setMnemonic(KeyEvent.VK_D);
    // action of Delete button
    jButton2.addActionListener( new ActionListener(){
    public void actionPerformed(ActionEvent actionEvent){
    int totalRows = jTable1.getRowCount();
    // If there are more than one row in table then delete it
    if( totalRows > 0){
    int selectedOption = JOptionPane.showConfirmDialog(null,"Are you sure you want to delete this audit row?","Coeus", JOptionPane.YES_NO_OPTION);
    // if Yes then selectedOption is 0
    // if No then selectedOption is 1
    if(0 == selectedOption ){
    // get the selected row
    int selectedRow = jTable1.getSelectedRow();
    System.out.println("Selected Row "+selectedRow);
    if( selectedRow != -1 ){
    DefaultTableModel dm= (DefaultTableModel)jTable1.getModel();
    java.util.Vector v1=dm.getDataVector();
    System.out.println("BEFOE "+v1);
    v1.remove(selectedRow);
    jTable1.removeRowSelectionInterval(selectedRow,selectedRow);
    System.out.println("After "+v1);
    }else{
    // show the error message
    JOptionPane.showMessageDialog(null, "Please Select an audit Row", "Coeus", JOptionPane.ERROR_MESSAGE);
    } // end of initcomponents
    class AcceptenceComboBoxRenderer extends JComboBox implements TableCellRenderer {
    public AcceptenceComboBoxRenderer(String[] items) {
    super(items);
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus, int row, int column) {
    if (isSelected) {
    setForeground(table.getSelectionForeground());
    super.setBackground(rowSelectionBackground);
    } else {
    setForeground(table.getForeground());
    setBackground(table.getBackground());
    // Select the current value
    setSelectedItem(value);
    return this;
    class AcceptenceComboBoxEditor extends DefaultCellEditor {
    public AcceptenceComboBoxEditor(String[] items) {
    super(new JComboBox(items));
    } // end editor class
    public class ValidateCellDataEditor extends AbstractCellEditor implements TableCellEditor {
    // This is the component that will handle the editing of the
    // cell value
    JComponent component = new JTextField();
    boolean validate;
    public ValidateCellDataEditor(boolean validate){
    this.validate = validate;
    // This method is called when a cell value is edited by the user.
    public Component getTableCellEditorComponent(JTable table, Object value,
    boolean isSelected, int rowIndex, int vColIndex) {
    if (isSelected) {
    component.setBackground(rowSelectionBackground);
    // Configure the component with the specified value
    JTextField tfield =(JTextField)component;
    // if any vaidations to be done for this cell
    if(validate){
    //tfield.setDocument(new JTextFieldFilter(JTextFieldFilter.NUMERIC,4));
    tfield.setText( ((String)value));
    // Return the configured component
    return component;
    // This method is called when editing is completed.
    // It must return the new value to be stored in the cell.
    public Object getCellEditorValue() {
    return ((JTextField)component).getText();
    // This method is called just before the cell value
    // is saved. If the value is not valid, false should be returned.
    public boolean stopCellEditing() {
    String s = (String)getCellEditorValue();
    return super.stopCellEditing();
    public void itemStateChanged(ItemEvent e) {
    super.fireEditingStopped();
    }//end of ValidateCellDataEditor class
    public static void main(String args[]){
    JFrame frame = new JFrame();
    AuditPanel auditPanel = new AuditPanel();
    frame.getContentPane().add(auditPanel);
    auditPanel.setAcceptenceOptions(new String[]{"Accepted", "Rejected", "Requested"} );
    java.util.Vector colVector = new java.util.Vector();
    colVector.add("Fiscal Year");
    colVector.add("Audit Accepted");
    colVector.add("Comment" );
    auditPanel.setColumnNames( colVector);
    auditPanel.renderPanel();
    frame.pack();
    frame.show();

    Hi,
    I've got the solution for it. As when the cursor is in cell of
    a row and hit the delete button, the data in that cell is not saved,
    So i'm trying to save the data first into the model then firing the action event by doing this ..
    jButton2.addActionListener( new ActionListener(){       
    public void actionPerformed(ActionEvent actionEvent){           
    // If a button press is the trigger to leave a JTable cell and save the data in model
    if(jTable1.isEditing() ){                   
    String text=((javax.swing.text.JTextComponent)jTable1.getEditorComponent()).getText();
    jTable1.setValueAt(text,jTable1.getSelectedRow(),jTable1.getSelectedColumn()) ;
    jTable1.getCellEditor().cancelCellEditing();
    // HERE DO THE DELETE ROW OPERATION
    <yaman/>

  • JTable problem when deleting all rows and reinserting data,

    Hi,
    I have a JTable with an AbstractModelTable.
    Some cells in the JTable have a custom cell editor. I am using
    the cell editor that accepts only numeric values as explained in
    the JTable tutorial (WholeNumberField).
    - The JTable gets filled by choosing a value from a JList
    for example:
    1- choose a customer name from the customer JList
    2- gets the customer order (database)
    3- fills the Jtable with the customer data.
    - When a customer is chosen from the Jlist I call a function
    inside my table model. (This function removes all rows, clears the vector holding the data and calls fireTableRowsDeleted (firstRow, lastRow));
    - Then I fill up the new data for this customer.
    All of this works fine, except if I have entered a new value inside
    one of the cell that has a customed cellEditor (ex: the Ordered column).
    for example : user enters number 20 in the "ordered" column for customer A. Then changes his mind and chooses customer B from the JList. So the JTable gets cleared and refilled with the data of Customer B but the column "ordered" still has the value '20'
    I would really appreciate any help...
    Thanks

    Don't know is this will work, but try the following before updating the table:
    if (table.isEditing())
      table.removeEditor();Also, why do two TableModelEvent's..one for all getting deleted, one for the new filling. You could do one fireTableDataChanged after the new data is in.

  • Problem in deleting the rows in a table

    I am trying to delete 1213 records from a table.
    When I am selecting the rows are selected within seconds.
    When I am trying to delete the same rows, the script hangs, can anybody, help in finding the issue here!

    Or that there are some foreign keys defined without indexes that are forcing Oracle to do 1213 full table scans on some large child table to ensure that the data you're deleting isn't referenced by some other row.
    Justin

  • How to delete a row in the table in servlets

    I have met a problem in deleting a row in table using servlets.
    My table looks like this:
    ID Name Type
    12 Milienium S
    15 USIA O
    My code looks like this:
    String query = "SELECT * FROM tb_Funds";
    rs = statement.executeQuery(query);
    while(rs.next()) {          
    StdID=rs.getString("FundID");
    StdName=rs.getString("Name");
    StdType=rs.getString("Type");
    out.print("<td><INPUT TYPE=TEXT NAME=
    myName VALUE=" + StdID + "></td>");
    out.print("<td>" + StdName + "</td>");
    out.print("<td>" + StdType + "</td>");
    buf.append("<td>" + "<INPUT TYPE=SUBMIT
    NAME=Delete VALUE=DELETE>" + "</td></tr>");
    There is a delete button in every row. May I know how to delete the row that I want by getting the ID from the table and delete it from the database.
                                       

    Deleting from a table is simple -> delete from tb_funds where id = <value>. Obviously replace <value> with the appropriate ID or use a bind variable (a ?) and prepared statements.
    Are you asking how to pass the id associated with the table row from the browser when the button is pressed?

  • Problem with delete operation

    Hi all,
    Jdev version(11.1.1.3.0)
    I have a <af:table> with a check box.I can select the rows
    by checking check box and delete those rows.
    Sometimes am facing a problem in deleteing the rows.
    The viewobject that binded to the table,is based on two
    Entity Objects A&B.The table B has no primary key field.But
    it has a dynamic row_id as key fileld.
    The problem is am not able to filter
    the query results,when I select dynamic "Row_Id" in the select
    query,I can't filter the records.(In the VO if I unselect the ROW_Id,
    got an error like"Row_id missing in the view oject")Because of
    this issue am not able to delete the records.Due to
    this problem,delete works only in random.
    Please share the ideas..
    Thanks
    Swapna

    Try selecting a different attribute for EntityB as a key field

  • Facing problem While deleting rows and adding rows

    Hi,
    In my form i have pass values to table rows by selecting values from Dropdown list.
    i have taken 3 hidden obj and passing the dropdown values to hidden objects and then from hidden objects to table rows.
    h1,h2,h2 are hidden obj
    EMPNO,EMPNAME, DESIGNATION are drop downlist
    i have add button with the following code
    if(form1.P1.ItemSet.EMPNO.rawValue != null){
    form1.P1.ItemSet.instanceManager.addInstance();
    form1.P1.execInitialize();
    var dynamicArray = form1.P1.resolveNode("ItemSet[" + arrayIncri + "]");
    dynamicArray .EMPNO.rawValue = form1.P1.hidden.h1.rawValue;
    dynamicArray .EMPNAME.rawValue = form1.P1.hidden.h2.rawValue;
    dynamicArray .DESIGNATION.rawValue = form1.P1.hidden.h3.rawValue;
    arrayIncri++;
    form1.P1.SF1.EmpID.rawValue = null;
    form1.P1.SF1.EmpName.rawValue = null;
    form1.P1.SF1.Designation.rawValue = null;
    My delete button code is
    _ItemSet.removeInstance(this.parent.index);
    form1.P1.execInitialize();
    My problem is adding is happening while click and deleting is happening to the perticular row but once i delete paricular row then again if i want to add new row then it is taking null values . and agian if i click add then the values are passing to the next row
    means i am getting null row if i do add funtionality after delete funtionality....
    Please help me out in this..
    Subba reddy

    Hi,
    I got the answer for this query, but when i do download and upload of the files from R/3 to GRC. Still it is not showing me the new transactions which were developed in R/3.
    it means when i try to add the transaction in a function, under search mode with respective of the r/3 system, it is not showing me the search results.
    What i did was, i run the reports /VIRSA/ZCC_DOWNLOAD_DESC & /VIRSA/ZCC_DOWNLOAD_SAPOBJ and uploaded them as below in GRC.
    Text Objects - /VIRSA/ZCC_DOWNLOAD_DESC
    permissions   -  /VIRSA/ZCC_DOWNLOAD_SAPOBJ
    For each of the download i get 2 files for each and i tried to upload both of them but no luck.
    Please suggest me, as am missing anything in this process
    SV

  • Problems deleting current row

    Hello,
    I have got the following problem. I have got a table with data from my database. And a dataprovider to fetch the data from my rowset. I have got a button in each row of this table where i can get details or delete the corresponding row.
    But when i click delete he wont delete the row correct. After a while i realised that the always fetch the same row. I dont understand why because i took the same code as it was used in the tutorial. For control i made a variable to remember the id of the fetched row but it wont change after the first "delete". Can somebody tell me why he wont change the value?
    public String l�schen_action() {
    try {
    RowKey rowKey = tableRowGroup1.getRowKey();
    int id = getSessionBean1().getMaxappid().parseInt(applikationDataProvider.getValue("APPID", rowKey).toString(), 10);
    getSessionBean1().setTemp(id);
    if(rowKey != null && applikationDataProvider.canRemoveRow(rowKey)){
    applikationDataProvider.removeRow(rowKey);
    applikationDataProvider.commitChanges();
    applikationDataProvider.refresh();
    } catch (Exception e) {
    log("Fehler beim L\366schen des Eintrags", e);
    error("Exception deleting row: " + e);
    } // end try catch
    return null;
    Thanks in advance for help
    Acinonyx

    Try this and see if that helps
    Rowkey currentRowKey = (RowKey) getBean("currentRow");
    - Winston
    http://blogs.sun.com/roller/page/winston?catname=Creator

  • Problems to delete Rows

    Hi,
    i want to delete all rows in a table which will be automaticlly updatet in a thread. the problem is that i get somtimes the message 9>=9 or 8>=3. did somebody know what that means ?!?

    it means the row index that you are trying to remove doesnt exist.
    9>=9 means that you are trying to remove row index 9 in a table that has only 9 itmes (remember its zero based)
    there's probably something dodgy with you remove code.
    off the top of my head try looping through with (rowcount - 1)

  • Problem in Delete Row

    Hai To All,
             Iam using PL 05 i have enable DeleteRow option. If i click the deleterow the row is deleted but after saving the entry there is null value in database. for example if i have 2 row in the matrix if i delete last row the content is deleted after that iam saving the matrix. In the database i have 2 rows one with content and other with null value..
    Whts the soultion of this....
    Does anyone have idea reply me....
    Regards,
    Anitha

    Hi Anitha,
    For the delete option, you need to right a small function if its going to be ur own form.
    Try using the following code...
    Private Sub DeleteRow()
            Dim oDBDSource As SAPbouiCOM.DBDataSource
            Dim Count As Integer
            Dim oMatrix As SAPbouiCOM.Matrix
            Try
                oDBDSource = objForm.DataSources.DBDataSources.Item("@TableName")
                oMatrix = objForm.Items.Item("3").Specific
                oMatrix.FlushToDataSource()
                oMatrix.DeleteRow(strRow)          
                objForm.Update()
                'objForm.DataSources.DBDataSources.Item("@TableName").RemoveRecord(strRow - 1)
                oDBDSource.Clear()
                oMatrix.FlushToDataSource()
                oMatrix.LoadFromDataSource()
                For Count = 1 To oDBDSource.Size - 1
                    oDBDSource.SetValue("Code", Count - 1, Count)
                Next        
            Catch ex As Exception
                MsgBox(ex.Message)
            End Try
        End Sub
    Hope this helps.
    Satish.

  • Problem in deleting row from database in table component

    Hi,
    I have a table component that its content change by diffrent links.
    in this table i have a hyperlink in each row to deleting that row from dataBase.
    so i must get the current row .
    i do it like this:
    define a rowset in the page that have a delete query :
    delete from response where responseID=?
    in action of delete hyperlink ,i have:
    Integer responseId=(Integer)responseDataProvider.
    getValue("#{currentRow.value['responseID']}") ;
    getSessionBean1().getResponseRowSet().setObject(1,responseId);
    getSessionBean1().getResponseRowSet().execute();
    but in first line occure a exception:
    illigalArgument #{currentRow.value['responseID']}
    thanks.

    by using data table
    first you should get current record (row that recived action)
    then delete it by using data provider.
    I do not think that you could execute delete statement using rowSets because they just can provide Select statements.
    btw , following code will retrive clicked row from data table and
    delete that row
    try {
    RowKey rk = getTableRowGroup1().getRowKey();
    if (rk != null) {
    testDataProvider.removeRow(rk);
    testDataProvider.commitChanges();
    } catch (Exception ex) {
    log("ErrorDescription", ex);
    error(ex.getMessage());
    hth
    masoud

  • BC4J: Problem deleting a row with clob field

    When I try to delete a row that contains a CLOB field.
    When I call the function removeCurrentRow in my View object I get this exception:
    JBO-25014: Another user has changed the row with primary key oracle.jbo.Key
    Could anyone tell me why I can't remove the row? Thanks in advance!
    null

    This looks like a bug in TreeBinding. Please file this as a bug/tar with OracleSupport with your reproducible testcase (or steps to reproduce). Thanks.

  • Error while  deleting a row in entity

    Hi
    I am facing a problem while trying to delete a row from a entity.
    Below is the scenario where i am facinmg a problrm.
    I have a ViewObject which has attributes from two entity and on e transient variable.
    in the RowImpl java class for the above Viewobject i changes the getter method of the transient variable to some text.
    I display all the Viewobject as a table in the UI.
    When a user selects a row and press delete method.
    I get a id(one of the attribute from the Viewobject) from the selected row and remove the row from the Entity.
    When i try to commit the changes i am getting the below error
    Another user has changed the row with primary key oracle.jbo.Key [742]. (Another user has changed the row with primary key {0}.)
    Can any one please help me in this
    Thanks
    Ranjith

    check {message:id=9271952}

  • Error while deleting a row from the Entity Object

    Hi OAF Guys,
    i am unable to delete the newly created row from the entity object.
    let me explain my scenario.
    1. i have a table of which some of the columns are mandatory.
    2. I am writing the code in the validateEntity to check wether the user really enter anything into the fields.
    3. My problem is, when the user creates row and wanted to delete the row without entering any details, the validate entity of the EO gets fired which will not allows to delete the row.
    Is there any workaround for this problem.
    Regards,
    Nagesh Manda.

    Hi Tapash,
    I am very sorry for not providing you the complete details of my scenario. Here i am explaining
    1. what code you have placed while creating the row and in validation method on EOImpl.
    while creating a new row i am initializing the primary key of the EO with the sequence value.
    2.When you say, you are unable to delete the row, are you getting a error message ? if yes, custom message or fwk error ?
    its not the fwk error, its the custom message which wrote in my validateEntity method of EO to check whether the user had entered all the necesary columns or not.
    3.How are you trying to delete the row ?
    while the user clicks on the delete switcher i am getting the primary key of the row and searching for the row in the vo and finally deleting it.
    The problem arises when the user creates a row, and later doesnt want to enter the details and delete it. Here while deleting the row the validateEntity method of the EO gets fired and doesnt allow me to do so :(.
    Any way appreciate your help tapash.
    Regards,
    Nagesh Manda.

  • HOW TO DELETE THE ROW FROM DATABASE

    hI,
    Iam pasting my code below.My problem isi retrieve rows from database and display them in jsp page in rows.For each row there is delete hyperlink.Now when i click that link i should only delete the row corresponding to that delete link temporarily but it should not delete the row from database now.It should only delete the row from database when i click the save button.How can i do this can any one give some code.
    thanks
    naveen
    [email protected]
    <%@ page language="java" import="Utils.*,java.sql.*,SQLCon.ConnectionPool,java.util.Vector,java.util.StringTokenizer" %>
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>Item Details</title>
    <script>
    function submitPage()
    document.details.action = "itemdetails.jsp" ;
    document.details.submit();
    </script>
    </head>
    <body>
    <form name="details" action="itemdetails.jsp" method="post">
    <%
    ConnectionPool pool;
    Connection con = null;
    Statement st;
    ResultSet rs =null;
    %>
    <table border="0" cellpadding="0" cellspacing="0" width="328">
    <tr>
    <td width="323" colspan="4"><b>Reference No :</b> <input type="text" name="txt_refno" size="14">
    <input type="submit" value="search" name="search" ></td>
    </tr>
    <tr>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item Code</b></font></td>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item No</b></font></td>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Amount </b></font></td>
    <td width="80" bgcolor="#000099"> </td>
    </tr>
    <%
    pool= new ConnectionPool();
    Utils utils = new Utils();
    double total =0.00;
    String search =utils.returnString(request.getParameter("search"));
    if(search.equals("search"))
    try
    String ref_no =utils.returnString(request.getParameter("txt_refno"));
    String strSQL="select * from ref_table where refno='" + ref_no + "' ";
    con = pool.getConnection();
    st=con.createStatement();
    rs = st.executeQuery(strSQL);
    while(rs.next())
    String itemcode=rs.getString(2);
    int item_no=rs.getInt(3);
    double amount= rs.getDouble(4);
    total= total + amount;
    %>
    <tr>
    <td width="81"><input type=hidden name=hitem value=<%=itemcode%>><%=itemcode%></td>
    <td width="81"><input type=hidden name=hitemno value=<%=item_no%>><%=item_no%></td>
    <td width="81"><input type=hidden name=hamount value=<%=amount%>><%=amount%></td>
    <td width="80"><a href="delete</td>
    </tr>
    <%
    }catch(Exception e){}
    finally {
    if (con != null) pool.returnConnection(con);
    %>
    <tr>
    <td width="323" colspan="4">
    <p align="right"><b>Total:</b><input type="text" name="txt_total" size="10" value="<%=total%>"></td>
    </tr>
    <tr>
    <td width="323" colspan="4">                   
    <input type="button" value="save" name="save"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    You mean when you click on the hyperlink you want that row to disappear from the page, but not delete the row from the database until a commit/submit button is pressed?
    Personally, I think I'd prefer that you have a delete checkbox next to every row and NOT remove them from the display if I was a user. You give your users a chance to change their mind about their choice, and when they're done they can see exactly which rows will be deleted before they commit.
    You know your problem, of course, so you might have a good reason for designing it this way. But I'd prefer not removing them from the display. JMO - MOD

Maybe you are looking for