passage de variable entre jsp ?
Bonjour;
j'ai une page jsp nommée demo_croise.jsp
Je veux passer le paramétre cl à une autre page nomée cache.jsp
code de demo_croise:
Code:
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 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278
|
<%@ page import="java.text.*, java.util.*,java.lang.Integer"%>
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>Affichage des alertes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK href="scripts/alerts.css" rel=stylesheet>
<script language=JavaScript src="scripts/content.js"></script>
<script>
function selectAll(){
document.form_alert.checkAll.checked=true;
if(!document.form_alert.alerts.length){
document.form_alert.alerts.checked=true;
}
else{
for(i=0;i<document.form_alert.alerts.length;i++){
document.form_alert.alerts[i].checked=true;
}
}
}
function deselectAll(){
document.form_alert.checkAll.checked=false;
if(!document.form_alert.alerts.length){
document.form_alert.alerts.checked=false;
}
else{
for(i=0;i<document.form_alert.alerts.length;i++){
document.form_alert.alerts[i].checked=false;
}
}
}
function doSelect(){
if(document.form_alert.checkAll.checked)selectAll();
else deselectAll();
}
function checkElement(elt){
if(!document.form_alert.alerts.length){document.form_alert.checkAll.checked=document.form_alert.alerts.checked;}
else{
document.form_alert.checkAll.checked=(howManyChecked()==document.form_alert.alerts.length);
}
}
function howManyChecked(){
var k=0;
if(!document.form_alert.alerts.length){k=(document.form_alert.alerts.checked?0:1);}
else{
for(i=0;i<document.form_alert.alerts.length;i++){
if(document.form_alert.alerts[i].checked) k++;
}
}
return k;
}
function closeMe(a,m,s){
opener.location.reload(true);
opener.location.replace("planninga.jsp?annee="+a+"&mois="+m+"§eur="+s);
self.close();
}
//onUnload="javascript:closeMe('<%=request.getParameter("annee")%>','<%=request.getParameter("mois")%>','<%=request.getParameter("secteur")%>')"
</script>
</head>
<jsp:useBean id="connection" scope="session" class="pfe.ConnectionBase"/>
<jsp:useBean id="Alerte" scope="page" class="pfe.Alerte"/>
<%
if (connection.getConnection()==null)
connection.initConnection();
Integer parser=new Integer(0);
int nombreDeLignes = 0;
int totalPages = 0; //nombre total des pages
int totalClass=0; // nombre total des classeurs
int pagesize = 10 ; //nombre de lignes par page
int classize=10;// nombre de pages par classeur
int p =request.getParameter("p")!=null?parser.parseInt((String)request.getParameter("p")):1; // la page selectionnée
int cl=request.getParameter("cl")!=null?parser.parseInt((String)request.getParameter("cl")):1; // le classeur selectionné
int fpi=0; // first page index : L'index de la première page du classeur courant
int lpi=0; // last page index : L'index de la dernière page du classeur courant
int fii=0; // first item index the current page
int lii=0; // last item index the current page
int rownum = 1;
%>
<body bgcolor="#FFFFFF" text="#000000">
<br><br>
<%
nombreDeLignes=Alerte.getNombreAlertes(connection.getConnection());
if(nombreDeLignes>0){
if(nombreDeLignes<=pagesize){
totalPages=1;
}else{
totalPages=(nombreDeLignes/pagesize)+(nombreDeLignes%pagesize!=0?1:0);
}
if(totalPages<=classize){
totalClass=1;
}else{
totalClass=(totalPages/classize)+(totalPages%classize!=0?1:0);
}
// calcul du "fpi" et "lpi"
if(totalClass==1){
fpi=1;
lpi=totalPages;
}
else{
if(cl==1)
{fpi=1;
lpi=classize;
}
else
{
fpi=(cl-1)*classize+1;
if(cl<totalClass)lpi=cl*classize;
else lpi=totalPages;
}
}
// calcul du "fii" et "lii"
if(p==1)
{ fii=1;
if(totalPages==1)lii=nombreDeLignes;
else lii=pagesize;
}
else
{ fii=(p-1)*pagesize+1;
if(totalPages==p)lii=nombreDeLignes;
else lii=pagesize*p;
}
}%>
<form name="form_alert" method="get" action="cache.jsp?">
<table width="97%" border="0" cellspacing="1" align="center">
<tr>
<td class="rubrique" colspan=8>Alertes courantes du réseau GSM </td>
</tr>
<tr>
<td colspan=8> </td>
</tr>
<tr>
<td colspan=2> </td>
<td colspan=2 align="right" class="ligne2">Alertes assignées à : </td>
<td colspan=3 align="left" class="ligne1">
<select name="user">
<option selected>KHARRAT Fahmi</option>
<option>BREGUELLIL Med Hedi</option>
<option>ZOHRA</option>
<option>ZAHMOUDI Kamel</option>
<option>SALMOUNI Sami</option>
</select>
</td>
</tr>
<tr>
<td colspan=8> </td>
</tr>
<tr>
<td width="6%" align="center" class="ligne2"><input type="checkbox" name="checkAll" value="" onClick="javascript:doSelect()" ></td>
<td width="90" nowrap class="Q" >CELL_CI</td>
<td width="109" nowrap class="Q">KPI_NAME</td>
<td width="89" nowrap class="Q">BSC</td>
<td width="92" nowrap class="Q">Etat</td>
<td width="82" nowrap class="Q">Valeur</td>
<td width="118" nowrap class="Q">Assignée à </td>
<td width="105" nowrap class="Q">Détail</td>
</tr>
<%
try
{
ResultSet rs = Alerte.getAlerte(connection.getConnection());
while(rs.next()){
//for (int i=1;i<nombreDeLignes;i++){ //remplacer par une boucle while
if((rownum >= fii) && (rownum <= lii)){%>
<tr>
<td align="center" width="6%" class="Q">
<input id="ckrue" type="checkbox" name="alerts" value="<%=rownum%>" onclick="checkElement(this)">
</td>
<td class="LIGNE1" nowrap><%=rs.getString("CELL_CI")%></td>
<td class="LIGNE1" nowrap><%=rs.getString("KPI_Name")%></td>
<td class="LIGNE1" nowrap><%="...."%></td>
<td class="LIGNE1" nowrap><%="...."%></td>
<td class="LIGNE1" nowrap><%="...."%></td>
<td class="LIGNE1" nowrap><%="...."%></td>
<td class="LIGNE1" nowrap >
<a href="javascript:void(0)" style="Float:left" onclick="return toggle_collapse('<%=rownum%>')">
<img src="images/haut_tcat_collapsed.gif" border="0" id="collapseimg_<%=rownum%>">Détails</a>
</td>
</tr>
<!--Début table body-->
<tr>
<td></td>
<td colspan="7">
<table class="tborder" cellSpacing="1" cellPadding="1" width="100%" align="center" border="0">
<tbody><tr><td colspan="4"></td></tr></tbody>
<tbody id="collapseobj_<%=rownum%>" style="display:none">
<tr><td colspan="3" class="rubrique">Détails de l'alerte <%=rownum%></td></tr>
<tr>
<td class="q" nowrap>Column1</td> <%//noms des champs %>
<td class="q" nowrap>Column2</td>
<td class="q" nowrap>Column3</td>
</tr>
<tr>
<td class="ligne1" nowrap>det1</td>
<td class="ligne1" nowrap>det1</td>
<td class="ligne1" nowrap>det1</td>
</tr>
<tr>
<td class="ligne1" nowrap>det2</td>
<td class="ligne1" nowrap>det2</td>
<td class="ligne1" nowrap>det2</td>
</tr>
</tbody>
</table>
</td>
</tr>
<!--Fin table body-->
<!-- Fin road bady -->
<% } //fin if
rownum++;
} //fin while
rs.close();
}// fin try
catch (Exception e){out.print(e.toString());}
%>
<% if (nombreDeLignes ==0){%>
<tr><td colspan="11" class="ligne2" align="center"><b>Aucune alerte détectée</b></td></tr>
<%}%>
<% if(nombreDeLignes>0){%>
<!-- Contrôle sur le profil user, ce button ne sera afficher que pour l'admin-->
<% if(1==1)/*session.getAttribute("nom")*/{%>
<tr><td colspan="8" align="left"><input type="submit" name="bValider" value="Valider l'assignation" action="cache.jsp"></td></tr>
<%}%>
<tr>
<td colspan="8">
<table border="0" cellspacing="2" width="100%" cellpadding="1">
<tr>
<td width="27%" align="left" class="chevronOrg">
<a class="chevron" href="javascript:selectAll()">Cocher tous</a>|
<a class="chevron" href="javascript:deselectAll()">Décocher tous</a></td>
<td width="45%" align="center" class="chevronOrg"> Alertes <%=fii%> à <%=lii%>
sur <%=nombreDeLignes%> alertes </td>
<td width="28%" align="right" class="chevronOrg">
Page <%=p%> sur <%=totalPages%>
</td>
</tr></table></td>
</tr>
<%} if(totalPages>1){%>
<tr>
<td colspan="8">
<table border="0" cellspacing="2" width="100%" cellpadding="1">
<tr>
<td width="27%" align="left" valign="middle" nowrap>
<%if(cl>1){%>
<a class="chevron" href="demo_croise.jsp?cl=<%=cl-1%>&p=<%=(cl-2)*classize+1%>" borber="0">
<img src="images/prev.gif" height="10" width="13" border="0">
Pages précédentes</a>
<%}%>
</td>
<td align="center" colspan="3" valign="middle">
<font class="chevronOrg"> Page : </font>
<% for(int i=fpi;i<=lpi;i++){
if(i==p){
%>
<font class="chiffreSelect"><%=i%></font>
<%}else{%>
<a title="Afficher les détails de la page <%=i%>" class="chiffre" href="demo_croise.jsp?cl=<%=cl%>&p=<%=i%>">
<%=i%></a>
<%}}%>
</td>
<td width="28%" align="right" valign="middle" nowrap>
<% if(cl<totalClass){%>
<a class="chevron" href="demo_croise.jsp?cl=<%=cl+1%>&p=<%=cl*classize+1%>">
<img src="images/next.gif" height="10" width="13" border="0">
Pages suivantes</a>
<%}%>
</td>
</tr>
</table>
</td>
</tr>
<%}%>
</table>
</form>
</body>
</html> |
voici le code de ma cache.jsp
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
<%@ page import="java.text.*, java.util.*,java.lang.Integer"%>
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<html>
<head>
<title>Affichage des alertes</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK href="scripts/alerts.css" rel=stylesheet>
<script language=JavaScript src="scripts/content.js"></script>
</head>
<jsp:useBean id="connection" scope="session" class="pfe.ConnectionBase"/>
<jsp:useBean id="Alerte" scope="page" class="pfe.Alerte"/>
<%
if (connection.getConnection()==null)
connection.initConnection();
int nombreDeLignes=Alerte.getNombreAlertes(connection.getConnection());
%>
</body>
</html> |