Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / September 2004

Tip: Looking for answers? Try searching our database.

Select and Edit a Record in a Table of JSP page

Thread view: 
John Rizzo - 19 Sep 2004 20:55 GMT
Hello All,

I am displaying the following Database records in a Table of my JSP
page.

Customer No.  FirstName     LastName

1         Tim            Hertal
2             John        Rizzo
3             Todd           Steven   

I want to select anyone of the record and perform Edit operation. When
I press Edit button, a new screen open up and take all values of the
selected row. Where I can make changes and send the data back to
database.
I am wondering if someone can help me or sends Java and JSP code or
provides any link where I can find information.

Thank you.
Oscar kind - 19 Sep 2004 21:49 GMT
> I am displaying the following Database records in a Table of my JSP
> page.
[quoted text clipped - 4 lines]
> 2             John           Rizzo
> 3             Todd           Steven    

Good, so you can select data from the database.

> I want to select anyone of the record and perform Edit operation. When
> I press Edit button, a new screen open up and take all values of the
> selected row. Where I can make changes and send the data back to
> database.
> I am wondering if someone can help me or sends Java and JSP code or
> provides any link where I can find information.

Before the row you can select, you can place radio buttons with as value
a representation of the primary key of the record (the customer number
for example).

Then, when the page is submitted, you know the record to edit.

Selecting the data to edit is something you already can: it's similar to
what you already have.

Editing the information is almost trivial, once you know two things:
1. What record to update
2. How to update a record

For point 1, add a hidden form field that contains a representation of the
primary key of the record being edited.

For point 2, read up on update statements and how to set SQL parameters.
That is, read the relevant part of any SQL manual, and the API for
java.sql.Statement and java.sql.PreparedStatement.

Signature

Oscar Kind                                    http://home.hccnet.nl/okind/
Software Developer                    for contact information, see website

PGP Key fingerprint:    91F3 6C72 F465 5E98 C246  61D9 2C32 8E24 097B B4E2



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.