[JSP] Help with Design decision

M

Marcus Reiter

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
 
R

Ryan Stewart

Marcus Reiter said:
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.
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top