Meaningless Drivel is fun!
The moose likes JSP and the fly likes code for modification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "code for modification" Watch "code for modification" New topic

code for modification

jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
Kindly explain me with a sample code as to how to modify a record..
I have shown in a jsp page the records inserted by the user..and next to that there is a modify link to modify that particular record.
The next page will show the values of that particular record and modify them.
I have an identity column in the table where records are inserted.
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63349

Rather than expecting someone else to provide your code for you, how about giving it a try yourself and then posting with the portions that you are having problems with?
Please refer to this topic.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
very right!!
here is my code for updation..
there is a browse page..which has links at the end of each modify..
like <a href="modify_teaching_load.jsp"?selected_Id="<%=ob.getLoad_id()%>" >Modify</a>
load_id is the identity column of my table..
and in modify page the code is like this:
con=DriverManager.getConnection("jdbc dbc:mech_iit");
String selected_Id="";
if(request.getParameter("Update")!=null)// if this page is called after hiting submit button.
stmt.executeUpdate("update teaching_load set semester='"+semester+"',course='"+course+"',course_no='"+course_no+"',course_title='"+course_title+"'");
<jsp:forward page="teaching_load_modified.jsp?RecordCount=5"/>

//this part will be executed..if this page is not called after hiting submit.
out.println("select semester, course, course_no, course_title from teaching_load where load_id in("+selected_Id+") ");
rs=stmt.executeQuery("select semester, course, course_no, course_title from teaching_load where load_id in("+selected_Id+") ");

catch(Exception ie)
bt on the next page..all the values are gettign displayed as null..
I agree. Here's the link:
subject: code for modification
It's not a secret anymore!