Hi how can I show the elements in my .jsp when I add something to my database. Here is my empservlet or the servlet of my code
//empServlet
package emppackage;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class empServlet extends HttpServlet {
String forward;
//empDAO myempDAO;
private static final long serialVersionUID = 1L;
//private empDAO disempdao;
public empServlet() {
super();
// myempDAO= new empDAO();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
empServices empserv= new empServices();
empserv.empadd(request.getParameter("eFname"),request.getParameter("eLname"),request.getParameter("eNameRes"),request.getParameter("eSerials"),request.getParameter("eJrss"),request.getParameter("eBand"),request.getParameter("eAcct"),request.getParameter("ePMPs"),request.getParameter("esJRSS"),request.getParameter("eOpenSeatDesc"),request.getParameter("eReqSkills"),request.getParameter("eReqBand"),request.getParameter("eDreject"),request.getParameter("eRreject"),request.getParameter("eDetActPlan"),request.getParameter("eDataComplete"),request.getParameter("eStat"));
//doGet(request, response);
}
}
Here is my employee dao where it is at arraylist
//empDAO
public List<empGetSet> getAllEmp()
{
List<empGetSet> empdetails = new ArrayList<empGetSet>();
try {
Connection conn = getConnection();
String showsql = "SELECT *FROM csemp;";
PreparedStatement psread= conn.prepareStatement(showsql);
ResultSet rsread = psread.executeQuery();
while (rsread.next())
{
empGetSet readgetset = new empGetSet();
readgetset.setFname(rsread.getString(1));
readgetset.setLname(rsread.getString(2));
readgetset.setNameRes(rsread.getString(3));
readgetset.setSerials(rsread.getString(4));
readgetset.setJrss(rsread.getString(5));
readgetset.setBand(rsread.getString(6));
readgetset.setAcct(rsread.getString(7));
readgetset.setPMPs(rsread.getString(8));
readgetset.setsJRSS(rsread.getString(9));
readgetset.setOpenSeatDesc(rsread.getString(10));
readgetset.setReqSkills(rsread.getString(11));
readgetset.setReqBand(rsread.getString(12));
readgetset.setDreject(rsread.getString(13));
readgetset.setsRreject(rsread.getString(14));
readgetset.setDetActPlan(rsread.getString(15));
readgetset.setDataComplete(rsread.getString(16));
readgetset.setStat(rsread.getString(17));
empdetails.add(readgetset);
psread.close();
conn.close();
}
}
Here is my created jsp
<%@ page language="java"
contentType="text/html;
charset=ISO-8859-1"
pageEncoding="ISO-8859-1"
import = "thisPackage.GetSet"
import = "thisPackage.LoginServlet"
import = "thisPackage.LogoutServlet"
%>
<%
response.setHeader("Cache-Control", "no-store, no-cache, must-revalidate");
response.setHeader("Pragma", "no-cache");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Hi welcome</title>
</head>
<body>
<center>
<h3>Hello </h3>
</center>
<form action ="LogoutServlet" method="post">
<div align="right"><input type = "submit" value= "Logout"></div>
</form>
<table border =1 cellpadding="18">
<thead>
<tr>
<th> First Name</th>
<th> Last Name</th>
<th> Name of Resource (LN ID Format)</th>
<th> Serial Number</th>
<th> JRSS</th>
<th> Band</th>
<th> Account (Proposed)</th>
<th> PMP Seat</th>
<th> Seat JRSS</th>
<th> Open Seat Description</th>
<th> Required Skills</th>
<th> Required Band low/high</th>
<th> Date of Rejection</th>
<th>Reason for Rejection</th>
<th>Detailed Action Plan</th>
<th>Target Date of Completion</th>
<th>Status(Ongoing/Closed)</th>
<th colspan=2>Do This</th>
</tr>
</thead>
</table>
<a href ="addDetails.jsp">Add Details</a>
</body>
</html>
How can I make it show, I've found some resources but I cant somehow put that into my project because it would not fit the way I write my code.