1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| <%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page language="java" import="cra.*,java.sql.*"%>
<jsp:useBean id="projBean" class="classprojet" scope="session" />
<jsp:useBean id="actBean" class="classactivite" scope="session" />
<!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=UTF-8">
<title>GESTION DES PROJETS</title>
</head>
<body>
<p><font color="#009900" size="5"><strong>GESTION DES ACTIVITES</strong></font></p>
<hr>
</font></strong></p>
<FORM method="post" action="activite.jsp" NAME="envoi">
<TR>
<TD><B>Liste des projets</B><BR>
<SELECT name="inpprojet" ONCHANGE="document.envoi.submit();">
<%
projBean.dbConnect();
if (projBean.selectProjet())
{
while (projBean.getElemSuiv())
{
String listeprojet = projBean.getElemNomChaine("nom_projet");
String idprojet = projBean.getElemNomChaine("id_projet");
%>
<option value='<%= idprojet %>'><%= listeprojet %></option>
<%
}
}
%>
</SELECT>
</TD>
</TR>
</FORM>
<TABLE border="1">
<TR>
<TD></TD>
<TD><B>LISTE DES ACTIVITES</B></TD>
</TR>
<%
String idprojet = request.getParameter("inpprojet");
int compteur = 0;
String bgColor = "";
Class.forName("com.mysql.jdbc.Driver");
String url = "jdbc:mysql://localhost/test";
String user = "root";
String pass = "nguyen";
Connection con = DriverManager.getConnection(url, user, pass);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM activite WHERE id_projet=" + idprojet);
if (rs != null){
while (rs.next())
{
String listeactivite = rs.getString("nom_activite");
String idactivite = rs.getString("id_activite");
if ((compteur % 2) ==0){bgColor = "#99CCFF";}
else{bgColor = "#CCFFFF";}
%>
<TR BGCOLOR="<%= bgColor %>">
<TD>
<A href='modifactivite.jsp?idactivite=<%= idactivite %>&listeactivite=<%= listeactivite %>'><img src=button_edit.png></A>
<A ONCLICK='javascript:return confirm("Etes-vous sur de supprimer cet élément ?")' href='delactivite.jsp?idactivite=<%= idactivite %>'><img src=button_drop.png></A>
</TD>
<TD><%= listeactivite %></TD>
</TR>
<%
compteur = compteur + 1;
}
}
projBean.dbDisconnect();
%>
</table>
<hr>
<table width="100%" border="0">
<tr>
<td><a href="logout.jsp">Se déconnecter</a></td>
<td><div align="right"><a href="projet.jsp">Projet</a></div></td>
</tr>
</table>
</body>
</html> |
Partager