Fetching value from database and add some rows and save in another table
mehta soham
Greenhorn
Joined: May 27, 2009
Posts: 8
posted
0
Hii all,
I am new to JSP,
M fetching few column values from the table and add one column in which m entering value manually and save all the data in another table while clicking on "Save" Button.
But M not getting the proper output.Please help me out.
I am getting success to get data of Employee Code,Employee name and Dept code from emp_mst.
now I am adding LWP(Leave without Pay) field for all the fetched value.After adding LWP how to save all the data in another table "i.e. leave_mst " while clicking on Submit button..
Following had written my code how it work...Please give me the solution for this..
------------------>
<%
String empmst="select empcd,emp_name,dept_cd from emp_mst";
DBConnection db = new DBConnection();
db.getConnection();
java.sql.ResultSet rs;
rs = db2.getAllData(empmst);
JSP is not the recommended place for doing DB operations. It is better to separate the model and view.
Anyway, if that is not an option for you, you can post the data to a servlet on hitting save and the servlet should take care for committing it to the DB.
Thanks and Regards
mehta soham
Greenhorn
Joined: May 27, 2009
Posts: 8
posted
0
Thanks...
can you tell me in detail about how can i do using servlet...??
can you give bit focus on it....