Multiple records manipulation

Posted on 2005-04-12
Last Modified: 2010-04-01
I need to insert, delete or update multiple records (rows by rows like a matrix) on a single jsp page which allows users to type in the necessary data in text fields (four of them), however, i have no idea of this, anybody can help? Thank you in advance. I am using Struts and EJB.
Question by:petergmk
    LVL 35

    Expert Comment

    Are you using entity beans?

    Your SQL should be in your EJB layer, so this should just be a case of writing an ActionForm, then writing a corresponding Action, then depending on the properties of the form, call the relevant method in your EJB layer...

    It may help things to write a wrapper for each "row" in your Matrix:

    public class RowWrapper implements Serializable
        String value1, value2, value3, value4 ;
        boolean delete ;

        // then write setters/getters for each attribute

    Then you can have a getList() method in your action form, and iterate over this list in the JSP (using logic:iterate), adding text input boxes for each string, and a boolean for the deleted property...

    LVL 19

    Accepted Solution


    You want to use what Struts calls an "indexed property". Here's a link to an article which I think directly corresponds to your problem that describes how to handle this with Struts.

    Best regards,
    Jim Cakalic

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Digital marketing agencies have encountered both the opportunities and difficulties that emerge from working with a wide-ranging organizations.
    DECT technology has become a popular standard for wireless voice communication. DECT devices are not likely to be affected by other electronic devices and signals because they operate in a separate frequency-band.
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now