TO DELETE PARTICULAR ROW IN HTML TABLE AND ALSO IN BACK END
(LOGICS IN JSP):-
<h1>
PROJECT LIST</h1>
<table
border="1">
<tr>
<td>
PROJECT ID
</td>
<td
align="center">
PROJECT
NAME
</td>
<td>
DEAD LINE
DATE
</td>
<td>
STATUS
</td>
<td>
ASSIGN
PROJECTS
</td>
</tr>
<form
method="post" action="Assignmem.jsp">
<%
List<String> projids = new ArrayList<String>();
List<String> members = new TeamClassInter().GetdATA();
String memid
= new TeamClassInter().getMemid();
System.out.println("MEMBERS ID.." + memid);
ArrayList
memids = new ArrayList(Arrays.asList(memid.split(",")));
String val =
session.getAttribute("curteam").toString();
List<String> groupdata = new
ArrayList(Arrays.asList(val.split(",")));
String tid
= groupdata.get(0);
String tname = groupdata.get(1);
Statement
stm = new Database_Connection().Database_Connection1().createStatement();
ResultSet
rs = stm.executeQuery("select * from projects where
assignedgroupid='" + tid + "'");
while
(rs.next()) {
%>
<tr>
<%
String
projid = rs.getString("projid");
String
status = rs.getString("status");
projids.add(projid);
%>
<td><%=projid%></td>
<td><%=rs.getString("project_name")%></td>
<td><%=rs.getString("deadlinedate")%></td>
<td><%=status%></td>
<td> <select
name="<%=projid%>">
<option value="SELECT TEAM">MEMBERS</option>
<%
for (int i = 0; i < memids.size(); i++) {
out.println("<option value=" + memids.get(i) +
">" + members.get(i) + "</option>");
}
%>
</select>
<a
href="confirmstatus.jsp?conid=<%=projid + "," +
status%>" onclick="return
confirm('Are You Sure want to Transfer the Status..? ');">CONFIRM_STATUS</a>
</td>
</tr>
<%
}
TeamClassInter.setData3(projids);
%>
</table>
<input
type="submit" name="addproj">
CALLING JSP SERVLET PAGE FOR CALLING DELETING ID:
<%@page
import="java.util.Arrays"%>
<%@page
import="java.util.ArrayList"%>
<%@page
import="java.sql.Statement"%>
<%@page
import="minnning.data.Database_Connection"%>
<%@page
import="java.sql.Connection"%>
<%@page
contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE
html>
<html>
<head>
<meta
http-equiv="Content-Type" content="text/html;
charset=UTF-8">
<title>CONFIRM
STATUS</title>
</head>
<body>
<%
String
consdatum=request.getParameter("conid");
ArrayList condata= new
ArrayList(Arrays.asList(consdatum.split(",")));
String
conid=condata.get(0).toString();
String
condname=condata.get(1).toString();
Connection con=new
Database_Connection().Database_Connection1();
String query="update projects
set leadstatus='"+condname+"' where
projid='"+conid+"'";
Statement
stm=con.createStatement();
stm.executeUpdate(query);
con.close();
out.println
("<html><body><script>alert('STATUS SUCCESSFULLY
SUBMITED TO TEAM MANAGER..');</script></body></html>");
RequestDispatcher rs1 =
request.getRequestDispatcher("teamprojects.jsp");
rs1.include(request,response);
%>
</body>
</html>
No comments:
Post a Comment