Deleting a row from my Jtable

I have MyTableModel class:
class MyTableModel extends AbstractTableModel{
         private Object columnNames[];
         private Object[][] data;
         public MyTableModel(Vector colonne, Vector corpoTabella){
              columnNames= new Object[colonne.size()];
              int nRighe=corpoTabella.size()/colonne.size();
              data=new Object[nRighe][colonne.size()];
              //inizializzo l'intestazione della tabella:
              columnNames= colonne.toArray();
              //inizializzo il corpo della tabella
              for(int i=0, k=0;i<nRighe;i++){
                   for(int j=0;j<colonne.size();j++){
                        data[i][j]=corpoTabella.get(k);
                        k++;
        public int getColumnCount() {
            return columnNames.length;
       public int getRowCount() {
            return data.length;
        public String getColumnName(int col) {
            return String.valueOf(columnNames[col]);
        public Object getValueAt(int row, int col) {
            return data[row][col];
        public boolean isCellEditable(int row, int col) {
                return false;
    }And I use it to create a JTable:
table=new JTable(new MyTableModel(colonne,corpo));I read on the tutorial to delete a row I have to use the DefaultTableModel in order to activate the removeRow method, but now how could I implementate it to delete rows?

ok now I have:
modelloTab=new MyTableModel(colonne,corpo);
table=new JTable(modelloTab);
class MyTableModel extends DefaultTableModel{
so I can write without errors:modelloTab.removeRow(0)but despite I wrote a lot of rows in the table when I run it I have a java.lang.ArrayIndexOutOfBoundsException ...what can I do?
Edited by: cassio_steel on Aug 25, 2008 1:52 AM
Edited by: cassio_steel on Aug 25, 2008 1:56 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Deleting a row from a JTable using AbstractTableModel

    Hi,
    Can someone please help me on how should i go about deleting a row in a jtable using the AbstractTableModel. Here i know how to delete it by using vector as one of the elements in the table. But i want to know how to delete it using an Object[][] as the row field.
    Thanks for the help

    Hi,
    I'm in desperate position for this please help

  • Deleting a row from a JTable using a custom TableModel

    Before I waste any of your time I would like to go ahead and just say that I have searched through the forum using "delete row from Jtable" as the search keywords and while I have found very closely related issues, they have not solved my problem. I have found code postings by carmickr and his arguments as to why we should use DefaultTableModel instead of having created our own custom TableModel, and while I do agree, I just am not quite confident enough in applying it to my scenario. See I am reading from a file a bunch of Contractor objects and I am stuffing it into an arraylist which I am using in the following code posting to populate my TableModel which the JTable object in the gui then uses.
    My problem is that everything works except when I delete and when I delete I understand that the index is changing because I just removed a row from the arraylist object. Suppose I have 33 rows displaying in the GUI. Now after I delete say row #23, the delete function works and dutifuly the row disappears from the table, but if I try to delete a row say...the last row, it does not work and throws me an IndexOutOfBoundsException which totally makes sense. My question is how do I go about fixing it? Do I have to do something with the setRowCount method?
    Any help is appreciated.
    Cheers,
    Surya
    * ContractorTableModel.java
    * Created on January 12, 2006, 11:59 PM
    package code.suncertify.gui;
    import java.util.ArrayList;
    import java.util.logging.Logger;
    import javax.swing.table.AbstractTableModel;
    import code.suncertify.db.Contractor;
    * @author Surya De
    * @version 1.0
    public class ContractorTableModel extends AbstractTableModel {
         * The Logger instance. All log messages from this class are routed through
         * this member. The Logger namespace is <code>sampleproject.gui</code>.
        private Logger log = Logger.getLogger("code.gui");
         * An array of <code>String</code> objects representing the table headers.
        private String [] headerNames = {"Record Number", "Contractor Name",
        "Location", "Specialties","Size", "Rate",
        "Owner"};
         * Holds all Contractor instances displayed in the main table.
        private ArrayList <Object> contractorRecords = new ArrayList<Object>(5);
         * Returns the column count of the table.
         * @return An integer indicating the number or columns in the table.
        public int getColumnCount() {
            return this.headerNames.length;
         * Returns the number of rows in the table.
         * @return An integer indicating the number of rows in the table.
        public int getRowCount() {
            return this.contractorRecords.size();
         * Gets a value from a specified index in the table.
         * @param row An integer representing the row index.
         * @param column An integer representing the column index.
         * @return The object located at the specified row and column.
        public Object getValueAt(int row, int column) {
            Object [] temp = (Object[]) this.contractorRecords.get(row);
            return temp[column];
         * Sets the cell value at a specified index.
         * @param obj The object that is placed in the table cell.
         * @param row The row index.
         * @param column The column index.
        public void setValueAt(Object obj, int row, int column) {
            Object [] temp = (Object []) this.contractorRecords.get(row);
            temp [column] = obj;
         * Returns the name of a column at a given column index.
         * @param column The specified column index.
         * @return A String containing the column name.
        public String getColumnName(int column) {
            return headerNames[column];
         * Given a row and column index, indicates if a table cell can be edited.
         * @param row Specified row index.
         * @param column Specified column index.
         * @return A boolean indicating if a cell is editable.
        public boolean isCellEditable(int row, int column) {
            return false;
         * Adds a row of Contractor data to the table.
         * @param specialty
         * @param recNo The record number of the row in question.
         * @param name The name of the contractor.
         * @param location Where the contractor is located
         * @param size Number of workers for the contractor
         * @param rate The contractor specific charge rate
         * @param owner Name of owner
        public void addContractorRecord(int recNo, String name,
                String location, String specialty,
                int size, float rate, String owner) {
            Object [] temp = {new Integer(recNo), name,
            location, specialty, new Integer(size),
            new Float(rate), owner};
            this.contractorRecords.add(temp);
            fireTableDataChanged();
         * Adds a Contractor object to the table.
         * @param contractor The Contractor object to add to the table.
        public void addContractorRecord(Contractor contractor) {
            Object [] temp = {new Integer(contractor.getRecordNumber()),
            contractor.getName(), contractor.getLocation(),
            contractor.getSpecialties(), new Integer(contractor.getSize()),
            new Float(contractor.getRate()), contractor.getCustomerID()};
            this.contractorRecords.add(temp);
            fireTableDataChanged();
         * Deletes a row of Contractor data to the table.
         * @FIXME Now that I deleted a row then I will have to reset the internal structure so that I can delete again
         * @param recNo The record number of the row in question.
        public void deleteContractorRecord(int recNo) {
            contractorRecords.remove(recNo - 1);
            fireTableRowsDeleted(recNo -1, recNo - 1);
    }

    Wow that was a very quick response. Thanks camickr. I am only trying to delete a single row. I do not know how to go about posting a test program for the code I have posted above because honestly the gui itself is 800 lines of code, and then the file reading class is quite funky in itself. I can maybe email you the entire Netbeans project including code so if you are using Netbeans 5 RC2 you can run the code and see for yourself, but that would not be considerate of me.
    See I am trying to delete any row at any time...but only one at a time not multiple rows...so if a user decides to delete row 23 and then tries to delete the last row which happens to be row 33 in my case, my setup should be smart enough to still allow to delete the row.

  • Deleting multiple rows from a JTable.

    When I am selecting the rows & deleting rows, it gives errors like arrayIndex out Of Bounds exception.
    Anyone pls solve the problem.

    bookmark the search page
    http://onesearch.sun.com/search/developers/index.jsp?charset=UTF-8&and=JTable+delete+row&nh=10&phr=&qt=&not=&field=&since=&col=devforums&rf=0

  • Deleting a row from JTable

    I am trying to delete a row from a JTable whenever the button on the last column is pressed. I know to do this, I can use the removeRow(int) method of the tableModel. But the odd thing is when I try to get a handle to the TableModel from the JTable to use that function, i.e. table.getModel().removeRow(int) it doesn't work. But if I explicitly pass in the tableModel into my class it does work. Here's the code below:
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.UIManager;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.table.TableCellEditor;
    import javax.swing.AbstractCellEditor;
    import javax.swing.table.DefaultTableModel;
    public class tester4 extends JFrame
         protected final int BUTTON_COL = 2;
         private TableCellRenderer defaultRenderer;
         private TableCellEditor defaultEditor;
         private JTable workingTable;
         private String[] transactionCols = {"Qty", "Product", "Cancel"};
         private Object[][] data = {{5, "prod1", "Cancel"},
                   {6, "prod2", "Cancel"},
                   {7, "prod3", "Cancel"}};
        public tester4()
              workingTable = new JTable(tableModel);
              workingTable.setName("Working Table");
              defaultRenderer = workingTable.getDefaultRenderer(JButton.class);
              defaultEditor = workingTable.getDefaultEditor(Object.class);
              StatusTableRenderer testRenderer = new StatusTableRenderer(defaultRenderer, defaultEditor, workingTable, tableModel);
              workingTable.setDefaultRenderer(Object.class, testRenderer);
              workingTable.setDefaultEditor(Object.class, testRenderer);
            JScrollPane scrollPane = new JScrollPane( workingTable );
            getContentPane().add( scrollPane );
         private DefaultTableModel tableModel = new DefaultTableModel(data, transactionCols){
              // Only allow button column to be editable, if there is an actual
              // button in that row          
              public boolean isCellEditable(int row, int col){
                   return (col == BUTTON_COL && data[row][col] != "") ? true : false;
              // Overriden getColumnClass method that will return the object
              // class type of the first instance of the data type otherwise
              // returns the Object.class
              public Class getColumnClass(int column){
                for (int row = 0; row < getRowCount(); row++){
                    Object o = getValueAt(row, column);
                    if (o != null){ return o.getClass(); }
                return Object.class;
        public static void main(String[] args)
            tester4 frame = new tester4();
            frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
            frame.pack();
            frame.setVisible(true);
        public class StatusTableRenderer extends AbstractCellEditor
                                                implements TableCellRenderer,
                                                               TableCellEditor,
                                                               ActionListener{
             private TableCellRenderer defaultRenderer;
             private TableCellEditor defaultEditor;
             private JButton cancelButton;
             private JButton editButton;
             private String text;
             private int buttonColumn;
             private int selectedRow;
             private JTable table;
             private DefaultTableModel tableModel;
             public StatusTableRenderer(TableCellRenderer renderer,
                                           TableCellEditor editor,
                                           JTable table,
                                           DefaultTableModel tableModel){
                  defaultRenderer = renderer;
                  defaultEditor = editor;
                  this.table = table;
                  this.tableModel = tableModel;
                  buttonColumn = table.getColumnCount() - 1;
                cancelButton = new JButton();
                editButton = new JButton();
                editButton.setFocusPainted(true);
                editButton.addActionListener(this);
             public StatusTableRenderer(TableCellRenderer renderer,
                                                TableCellEditor editor,
                                                JTable table,
                                                DefaultTableModel tableModel,
                                                int _buttonColumn){
                  this(renderer, editor, table, tableModel);
                  buttonColumn = _buttonColumn;
             public Component getTableCellRendererComponent(JTable table, Object value,
                       boolean isSelected, boolean hasFocus, int row, int column) {
                  if (column == buttonColumn){
                       if (hasFocus){
                            cancelButton.setForeground(table.getForeground());
                            cancelButton.setBackground(UIManager.getColor("Button.background"));
                       else if (isSelected){
                            cancelButton.setForeground(table.getSelectionForeground());
                            cancelButton.setBackground(table.getSelectionBackground());
                       else{
                            cancelButton.setForeground(table.getForeground());
                            cancelButton.setBackground(UIManager.getColor("Button.background"));
                       cancelButton.setText( (value == null) ? "" : value.toString() );
                       return cancelButton;
                return defaultRenderer.getTableCellRendererComponent(
                            table, value, isSelected, hasFocus, row, column);
             public Component getTableCellEditorComponent(JTable table, Object value,
                       boolean isSelected, int row, int column){
                  if (column == buttonColumn){
                       text = ((value == null) ? "": value.toString());
                       editButton.setText(text);
                       selectedRow = row;
                       return editButton;
                  return defaultEditor.getTableCellEditorComponent(
                            table, value, isSelected, row, column);
            public Object getCellEditorValue()
                return text;
            public void actionPerformed(ActionEvent e)
                fireEditingStopped();
                // This works
                tableModel.removeRow(selectedRow);
               // This does not work
              //  table.getModel().removeRow(selectedRow);
    }Take a look at the actionPerfformed method. One way of doing it works, one doesn't. Just trying to understand why me getting a handle to the tableModel through the table doesn't work.
    Message was edited by:
    deadseasquirrels

    It gives me a run-time error Well then your question should be "why do I get this run-time error" and then you would quote the error. Be more descriptive. "It doesn't work" is not descriptive.
    table.getModel().removeRow(selectedRow);I don't use JDK1.5 either. But if you are saying that the above line compiles cleanly with JDK1.5 (because of the auto-boxing feature, or whatever its called), then I see no reason why the code wouldn't work since it recognizes the class as a DefaultTableModel.
    Presumably you commented out the other line so you don't try to delete the row twice. Otherwise you might be getting a indexing error.

  • Deleting rows from a JTable

    Hello,
    I've got a JTable which is based on a 2-dimensional array, which contains my data. Now I want to delete several rows from the JTable. There's the possibility to modify my data-array by creating a new array which doesn't contain anymore the datasets I want to delete. Afterwards I can redraw the table and my rows are deleted. But I think that's a very complicated way to delete rows from a JTable. Can anybody tell me whether ther's an easier way to do so ? I'd really be pleased...
    Thanx,
    Findus

    When you create a TableModel using a two-dimensional array or a Vector of Vectors, a DefaultTableModel is created and it stores the data in its own Vector of Vectors. The DefaultTableModel supports methods for adding/removing rows of data. To remove the first row in the table you would do something like:
    DefaultTableModel model = (DefaultTableModel)table.getModel();
    model.removeRow( 0 );
    Note: once you create the TableModel you should set your array to null as it is not used anymore.

  • Removing rows from a JTable

    How can i remove a row from a JTable??

    You need to extends AbstractTableModel rather than use DefaultTableModel as I think from memory this just uses an array to store data.
    If you use a vector in your subclass to store your rows, then you can do something like this:
        public boolean delete(int rowIndex)
            if (rowIndex < 0 || rowIndex >= rowVector.size())
                return false;
            else
                int day = 0;
                MyRowClass row = rowVector.get(rowIndex);
                rowVector.remove(rowIndex);
                rowCount--;
                fireTableRowsDeleted(rowIndex, rowIndex);
                return true;
        }HTH
    Paul C.

  • 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

  • How to delete multiple rows from ADF table

    How to delete multiple rows from ADF table

    Hi,
    best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
    Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
    Frank

  • Deleting a row from a Procedure

    Hi All
    Can one of you tell me how to delete a row from a Procedure
    It is created with
    CREATE OR REPLACE PROCEDURE report.NAMEOFTABLE
    (nPutId IN Report.ID%TYPE,
    cArea IN Report.Area%TYPE,
    cSubject IN Report.Subject%TYPE,
    nUserId IN Report.EngineerID%TYPE,
    cDesc IN Report.Description%TYPE,
    cSide IN Report.SideEffects%TYPE,
    cImpact IN Report.Impact%TYPE,
    cNotes IN Report.Notes%TYPE,
    nValid IN Report.Valid%TYPE) AS
    -- Add or update Report
    -- If nId < 1 then a record is added, otherwise updated.
    BEGIN
    IF nId < 1 THEN
    INSERT INTO Report
    (Area, Subject, EngineerID,
    Description, SideEffects, Impact,
    ReportNotes, Valid)
    VALUES
    (cArea, cSubject, nUserId, cDesc, cSide, cImpact, cNotes, nValid);
    ELSE
    UPDATE Report
    SET ReportArea = cArea,
    ReportSubject = cSubject,
    ReportDescription = cDesc,
    ReportSideEffects = cSide,
    ReportImpact = cImpact,
    ReportNotes = cNotes,
    ReportValid = nValid
    WHERE ReportID = nPutId;
    END IF;
    COMMIT;
    END;
    CREATE SYNONYM Admin.NAMEOFTABLE
    Report.NAMEOFTABLE;
    But I need to make 1 field of the impact and the sideEffect called the ImpactEffect
    So how do i delete the field of Side effect and change the name of the Impact field.
    Sould I make a new Procedure?

    If you want to delete a row, you'd need a DELETE statement. It is not obvious to me, though, that you really want to delete a row. It sounds like you're trying to update a row, and there is an UPDATE statement in the procedure. Unfortunately, I'm very unsure exactly what you're trying to accomplish and how this procedure relates to that goal. Perhaps if you could post the starting state of the row, the procedure call you're trying to make, and the end state of that row, things might be much clearer.
    As an aside, do you really have a schema and a table named REPORT? That seems rather confusing.
    Justin

  • Deleting a row from a table control through right-clic​k menu

    I have a table control. I want to delete a row from it when a user right clicks on a particular row and selects "Delete row" menu item. I have managed the creation of menu item but have not been able to delete the row which is right clicked and the menu item "Delete row" is selected. Guidance required! Thanks!

    smercurio_fc wrote:
    It's irrelevant whether the table is a control or indicator. See attached VI.
    Hi smercurio,
    please see the attached picture. In my previous post i mean the different in the menu. The red marked function is not available, if the table is an indicator. LV8.5!
    Mike
    Message Edited by MikeS81 on 04-18-2008 05:19 PM
    Attachments:
    Unbenannt.PNG ‏22 KB

  • Deleting a row from a Row Repeater

    Hi All,
    How could i delete a row from a row repeater??????
    I am using REMOVE_ELEMENT method from IF_WD_CONTEXT_NODE interface... Is this the correct way!!!!!!.
    Is there anyother way to do the same?????
    Best Regards.
    Shafiq Ahmed Khan.

    Hi
    first u get the index from the context element. with the help of the index u can get that particular element using get element.
    then u remove the element .
    check this code.
    CALL METHOD context_element->get_index
      receiving
        my_index = lv_index.
    CALL METHOD lo_nd_rcf_edu_det->get_element
      EXPORTING
        index        = lv_index
      receiving
        node_element = lo_el_rcf_edu_det .
    CALL METHOD lo_nd_rcf_edu_det->remove_element
      EXPORTING
        element          = lo_el_rcf_edu_det
    receiving
       has_been_removed =
    Declare a parameter context_element in the method of type if_wd_context_element
    regards
    chythanya

  • Deleting a row from matrix by context menu

    Hi all
    does anyone know how can i cause right click on mouse button. on a certain row within a matrix to show a context menu with the option to delete the row. and when pressing the menu item handling the event of deleting the row from the matrix?
    appreciate the help
    Yoav

    Hi Yoav,
    Simply, 'context menu' have to be handled with 'menu event' object.
    It can be done by 'flushToDataSource' method and some tricks.
    Basically, method delete the row without any clause of addon code.
    But it's only can be done in display side.
    If you're using DBDataSource, you have to flush to the datasource.
    I mean, you have to update datasource with the data displayed in the matrix.
    and then, delete the last row of the datasource.
    FlushToDataSource doesn't affect to the number of rows in the datasource.
    You have to delete a row with a method of DBDatasource.. I can't remember the name.
    If, the matrix uses userdatasource, you don't need to delete a row in datasource.
    Because userdatasource doesn't have a concept of 'row', actually.
    Hope this helpful for you.
    Regards,
    Hyunil Choi

  • Deleting a row from a database...

    Here is the method I am calling to delete a row from a database. I keep getting this error, but I am not sure why.
    Error: "Too few parameters. Expected 1."
    //To delete a row
      public void removeRow(String x, String y) {
       try {
       Statement stmt = con.createStatement();
       //delete row with same x and y
    //first is a string and second is a number
       String query = "DELETE * FROM table WHERE first = '" +x+ "' AND " +
       "second = " +Integer.parseInt(y);
       int result = stmt.executeUpdate(query); //runs delete query, ERROR HERE *************
       System.out.println("Test"); //debug statement, never gets here
       //deletion confirmation message
       JOptionPane.showMessageDialog(null, "Row deleted",
       "Delete Reservation", JOptionPane.INFORMATION_MESSAGE);
          catch (Exception e) { System.out.println(e); }

    Additionally, in the future you might want to use:
    catch(SQLException sqlx) {
      System.out.println( sqlx.getSQLState()
                                       +"\t"+sqlx.getMessage()
                                       +"\t"+sqlx.getErrorCode() );... It'll help with diagnostics.
    &#9786;Bill

  • Deleting a row from a table using jsp

    Given a table in a jsp, can an user click on a row of that table and retrieve the information so that the program can delete a record from a database table?
    most of the tables that I have seen are static, the user cannot interact with them(specially when the user wants to delete several records from a database table).
    Can anyone suggests a good book or way of deleting a row from table using jsp.

    eg use a column in the table that has a radio button or check box,
    on submit, get all the rows that are checked, using the row as an index into your db store, get the key and use the key to issue the sql delete command.

Maybe you are looking for

  • Array of cluster label

    I have an array of clusters that are PID parameters for the NI motion card (one for each axis). I would like to change the label for the array based on the cluster (index) that is being displayed. When I try to do this, I get the error Error 1073 occ

  • Problem with changing tonality in CS5

    Hello, I recently upgraded to CS5 from CS3 after buying a new iMac. With CS5 I've been having this problem when I try to make certain images darker using levels, it just reverts back to the previous state and only gets darker very minimally. I even t

  • N73 Backup.arc

    Hi I went to a Nokia Service centre with a faulty speaker problem, and the phone was then backed up by one of the support staff. I requested this person to backup the phone on the PC, and then copy the backup to the memory card on the phone. This per

  • Maxl error rename cube

    Hi all, I am using this script to kill and disable the connection before renaming the cube , If any one is using that cube or doing reports in that cube , I want to kill and diconnect connectionn that session before renaming but its throwing errror I

  • Can't open iWeb files to upload to internet

    Hi I created my website using iWeb, and use iWeb SEO Tool (3rd party software) to upload onto the internet so that my website can be found on the net. But since upgrading to Lion OSX I can't open my iWeb file in iWeb SEO  - my Library file has been m