Hi, I want to create a very simple search function on my jsp page which connects to servlet and mysql database. I want to search the ID attribute of the Staff database and then list out it's record. What is the algorithm to do it? Thanks Andrew
1. Write a bean that reads your database and formats a html table. (you need to do several things: load the mySQL driver, get a connection, query the database, format the table using the result set). 2. Use the bean in your jsp file.
BJ - SCJP and SCWCD
We love Java programming. It is contagious, very cool, and lot of fun. - Peter Coad, Java Design
I want to make a search for Staff ID, Staff Name OR Staff Salary. Once input either of these 3 fields, it will show display the result on the same jsp page. But, how should I write the servlet: while(pstmt.next()) out.println(pstmt.getInt(staff.getStaffID())+ ", " + pstmt.getString(staff.getStaffName()) + ", " + pstmt.getDouble(staff.getSalary()));
and those code in the JSP page? Thanks for any help. Andrew