File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes modify.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "modify.." Watch "modify.." New topic
Author

modify..

jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
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

Joined: Oct 12, 2000
Posts: 5093

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 ]

42
jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
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

Joined: Nov 26, 2002
Posts: 211
Jeroen..............
You have given an EXCELLENT Example for the beginner.


Thanks,
Mathews
Mathews P Srampikal
Ranch Hand

Joined: Nov 26, 2002
Posts: 211
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

Joined: Oct 12, 2000
Posts: 5093
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

Joined: Sep 26, 2003
Posts: 135
thanks..a lot everyone..
will try to solve this problem..in case any problem the ranch is always there..
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: modify..
 
Similar Threads
showing records for updating value after click on modify link on masterpage.
code for modification
Stateless web service and caching
recent entries from the database
what is principal realm?