[JSP] Help with Design decision

Discussion in 'Java' started by Marcus Reiter, Dec 29, 2004.

  1. I have a list of data coming from the database that shows me
    tests and wether or not people (showing their id) have signed up for them
    already
    or not yet.

    Using plain JSP I need to create a checkbox for each of those values and if
    that person
    has already signed up for that test it needs to be checked, while it needs
    to be unchecked if
    the person has not yet signed up.

    It also has should be possible to check / uncheck checkboxes and then to add
    / delete values from the database.

    How would you design this?

    For one person, I thought about an array that has the name of the test and
    then in the next field wether or
    not the person has signed up for this test or not.

    Now in the jsp a new array will be created.

    Would you compare both arrays and just update those values that have changed
    or would you
    just delete all entries of that person and recreate all entries?

    What easier / better in performace / better design whise?

    Any ideas?

    Thanks,

    Marcus
     
    Marcus Reiter, Dec 29, 2004
    #1
    1. Advertisements

  2. Marcus Reiter

    Ryan Stewart Guest

    Is this the same assignment you were asking about in the other post? You
    were supposed to do this with only jsp tags?
    Better to go OO. One possiiblity:
    public class User {
    String name;
    TestPanel tests;
    }

    public class TestPanel {
    Map tests; // key=Test, value=Boolean indicating selected
    }

    public class Test {
    String name;
    }

    This is just bare bones obviously.
    For performance, it's almost always better to only do what updates are
    necessary. For ease of coding, it's almost always better to just rewrite
    everything.
     
    Ryan Stewart, Dec 30, 2004
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.