我有用于显示表中记录的servlet代码。 我想将相同的代码转换为jsp代码。 请帮助我将SERVLET代码转换为JSP代码。 servlet工作正常
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.hai.jsp.Emp;
import com.hai.jsp.EmpDao;
@WebServlet("/ViewServlet")
public class ViewServlet extends HttpServlet {
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out=response.getWriter();
out.print("<html><head><link rel='stylesheet' href='styles.css'></head><body>");
out.println("<a href='index.html'><b>ADD NEW EMPLOYEE</b></a>");
out.println("<h1 style='color: #ff3399' align='center'><u>EMPLOYEES LIST</u></h1>");
List<Emp> list=EmpDao.getAllEmployees();
out.print("<div id='div1'><table border='1' width='100%' style='color: #ff3399'");
out.print("<tr><th>Id</th><th>FIRST NAME</th><th>LAST NAME</th><th>GENDER</th><th>DESIGNATION</th><th>MOBILE</th><th>DATE OF BIRTH</th><th>ADDRESS</th><th>COUNTRY</th><th>Edit</th><th>Delete</th></tr>");
for(Emp e:list){
out.print("<tr><td>"+e.getId()+"</td><td>"+e.getFName()+"</td><td>"+e.getLName()+"</td> <td>"+e.getgender()+"</td><td>"
+e.getdesignation()+"</td><td>"+e.getmobile()+"</td><td>"+e.getdob()+"</td><td>"+e.getaddress()+"</td><td>"
+e.getCountry()+"</td><td><a href='test?id="+e.getId()+"' >EDIT</a></td><td><a href='DeleteServlet?id="
+e.getId()+"'>DELETE</a></td></tr>");
}
out.print("</table></div>");
out.print("<div id='div2'>"
+ "</div> ");
out.print("</body></html>");
out.close();
}
}