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

modify..

 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
need to modify records in a jsp page..can anyone guide me as to what can be the proper logic of the same..
will show the records and against each a checkbox and when the user clicks the modify link..that particular record is available for modification..
please tell me how to solve this..
thanks
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You will get the request parameter "cb" containing the indices (from 1 up) with the selected rows as their values.
This examples shows only the first 100 entries from the minimum index.
[ March 17, 2004: Message edited by: Jeroen Wenting ]
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks..
bt iam working on jsp and ms-sql as the database..
how do i show that particular record..that the user has selected..for modifications..i have an id as the identity column..
thanks
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jeroen..............
You have given an EXCELLENT Example for the beginner.
 
Mathews P Srampikal
Ranch Hand
Posts: 211
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is better to give Radio Button instead of check box as you will be editing one record.If the records displayed in the loop,Give a particular id for the selected record and get the record displayed on clicking the edit button.pass the ID as hidden value.Then on the next jsp you get the value and display.on submitting you can fire an update query to database.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
simply map the row id retrieved from the JSP to the primary key for the database to retrieve the correct row.
Easiest way to do that is to read all the records you list initially into memory (or at the very least their primary keys) as objects (which you can then use in the list as well) and put them into a List.
The number(s) you retrieve from the JSP are then an index into that List (with an offset of 1).
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks..a lot everyone..
will try to solve this problem..in case any problem the ranch is always there..
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic