上述代码中的HTML页面将雇员ID发送给servlet。要创建servlet读取客户机发送的雇员ID并检索雇员的详细信息,需要执行以下步骤:
package Emp;
/* Import the required packages. */
import java.io.*;
import java.aql.*;
import javax.servlet.*;
import javax.http.*;
public class EmployeeDetails extends HttpServlet
{
static in i;
Connection con;
PrintWriter out;
ResultSet rs;
public void init( )
{
i = ;
con = null;
out = null;
rs = null;
}
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
{
i++