Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Books or Links - Database Application

 
Zac Roberts
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Brian Glodde
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 173
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the explanation and the link to the book... I think I can take it from here!
 
Zac Roberts
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic