tags:

views:

56

answers:

2

How many JSPs to create to maintain one table for data entry. Add.jsp to enter a new record and Update.jsp to update an already entered record. Is this a good idea or create only one jsp and use that for add and update using some parameter as all the fields and functionality remains same. Only difference is at the time of update few fields will be disabled and you need to pre-populate the form. I can use struts or jsf to develop this.

+3  A: 

Better use one page, and differentiate between new and existing based on some criteria - for example, if the id of the object is 0. Even if you make two pages, you can include the common content so that you don't copy-paste.

Bozho
I agree on the single page solution. +1
Adeel Ansari
A: 

I like the one page approach too.

You could have a dropdown box containing the ids' or some other value that provides an easy way for the user to find a specific record and whatever other html elements you need on the page for displaying a record.

They make a choice using the drop down box if they wish to edit a record and then that records data is displayed on the page for editing, the user enters the corrections and hits the submit button.

If they want to enter a new record, then they do not make a choice using the dropdown box and instead just fill in the fields on the page and hit submit.

When posting back to the page you can check and see if a selection was made using teh dropdown box and if not enter a new record and if a choice was made then you update the record that corresponds to the selection made from the dropdown box.

ChadNC