• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

Multiple records manipulation

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.
0
petergmk
Asked:
petergmk
1 Solution
 
TimYatesCommented:
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...

Tim
0
 
Jim CakalicSenior Developer/ArchitectCommented:
Hi,

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.
    http://www.developer.com/java/other/article.php/2233591

Best regards,
Jim Cakalic
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now