aspose file tools*
The moose likes Servlets and the fly likes Books or Links - Database Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Books or Links - Database Application" Watch "Books or Links - Database Application" New topic
Author

Books or Links - Database Application

Zac Roberts
Ranch Hand

Joined: Jan 29, 2002
Posts: 82
Hey-
I am learning server side java and would like to make a database application. This would basically be a data entry type of thing. I have figured out how to insert and retrieve from the database using jsp/beans but I have not yet figured out how to edit/resubmit fields already in the database, so that the fields could be edited and resaved into the same database position. Does anyone know of a book or some links that describe this type of application?
Thanks


Zac Roberts<br />SCJP2
Brian Glodde
Ranch Hand

Joined: Jun 27, 2001
Posts: 171
Zac, Insert, modify & delete operations are all basically the same mechanism as your existing queries but with different SQL. To update a record that already exists, you'll use something like:
"UPDATE table_name SET column_name = new_value
WHERE column_name = some_value"

Now that you've already figured out SELECT and INSERT, all you have to do is display a list (links) of the existing records. When the user clicks on one, the record id will be in the querystring, then the edit page can select that record again from the db, based on the row id from the querystring, and display the relevant fields in the form. When they've finished the editing, I would recommend doing some remedial client side JavaScript form validation, then pass it to your bean or servlet and issue the UPDATE.
Hope that helps!
Rick Salsa
Ranch Hand

Joined: Jul 17, 2001
Posts: 173
if your looking for a book that covers databases, servlets, jsp etc.... take a look at JSP, Servlets, and MySql. It got a really good review in the bunkhouse.
/rick
Zac Roberts
Ranch Hand

Joined: Jan 29, 2002
Posts: 82
Thanks for the explanation and the link to the book... I think I can take it from here!
Zac Roberts
Ranch Hand

Joined: Jan 29, 2002
Posts: 82
One more question, when we talk about clicking on a single record/row, which field is usually given the link and how is this usually done? Is the HTML <a href="whatever"> tag simply put straight into the database on the unique priamry key/id or is this link generated by the JSP somehow? Sorry if i am confused here.
 
wood burning stoves
 
subject: Books or Links - Database Application