[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. Advertising

  2. Marcus Reiter

    Ryan Stewart Guest

    "Marcus Reiter" <> wrote in message
    news:cqv4qh$o5b$05$-online.com...
    >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.
    >


    Is this the same assignment you were asking about in the other post? You
    were supposed to do this with only jsp tags?

    > 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.
    >

    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.

    > 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?
    >


    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. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. tubby

    Help with design decision

    tubby, Dec 2, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    352
    cbDevelopment
    Dec 4, 2005
  2. Jeff Marder

    Feedback on a design decision?

    Jeff Marder, Oct 5, 2006, in forum: Java
    Replies:
    15
    Views:
    563
    Christopher Benson-Manica
    Oct 9, 2006
  3. __PPS__

    Class design decision

    __PPS__, Dec 7, 2006, in forum: C++
    Replies:
    5
    Views:
    340
  4. pek
    Replies:
    15
    Views:
    578
  5. koranthala

    A Twisted Design Decision

    koranthala, Jan 27, 2009, in forum: Python
    Replies:
    0
    Views:
    242
    koranthala
    Jan 27, 2009
Loading...

Share This Page