[JSP probleme]tableau problème d'ordre algorithmique
Bonjour j'ai un petit soucis, d'ordre algorithmique, avec java, j'ai ce code qui m'a été donné, et je n'arrive pas à solutionner la problèmatique suivante, c'est à dire mettre en gras plusieurs langues, à partir d'une liste : alistofLangues. Voici le code qui ne met en gras qu'une langue, je voudrai par exemple trois
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
|
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@page import="com.examples.util.misc.Linguisticversion"%>
<%@page import="java.util.ArrayList"%>
<%@page import="java.util.List"%>
<%@page import="java.util.*"%>
<!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>Test Gremelin</title>
<%
List<String> objResult = new ArrayList<String>();
//Ici, on récupère nos langues, qu' on met dans une liste
for(int j=0;j<Linguisticversion.Linguistic.length; j++)
{
objResult.add(Linguisticversion.Linguistic[j].toUpperCase());
}
%>
</head>
<body>
<table border="0" cellspacing="0" cellpadding="3" width="100%"
align="center">
<tr>
<%
//List<String> objResult2 = Linguisticversion.Linguistic;
boolean boNewline = false;
int intNbreofColumn = 0;
List<String> alistofLangues = new ArrayList<String>();
alistofLangues.add("DE");
//,,
alistofLangues.add("FR");
alistofLangues.add("EN");
// Parcours des éléments
for (int i = 0; i < objResult.size(); i++) {
if (boNewline){
boNewline = false;
%>
</tr><tr>
<%
}
//for(int j=0;j<alistofLangues.size();j++)
//{
//String x= alistofLangues.get(j);
if(objResult.get(i).equals("EN"))
{
%>
<td><b><%=objResult.get(i)%></b></td><td></td>
<%
}else {%>
<td><%=objResult.get(i)%></td><td></td>
<%}//}
intNbreofColumn = intNbreofColumn + 1;
// Quand on a une ligne de 12 colonnes, on valide la création d'une nouvelle ligne
if (intNbreofColumn == 6){
intNbreofColumn = 0;
boNewline = true;
}
}
%>
</tr></table>
</body>
</html> |
La petite classe qui contient les langues donne ceci
Code:
1 2 3 4 5
|
public class Linguisticversion
{
public static final String[] Linguistic={"BG","CS", "DA", "DE", "EL", "EN", "ES", "ET", "FI", "FR", "GA", "HU", "IT", "LT", "LV", "MT", "NL", "PL", "PT", "RO", "SK", "SL", "SV", "SE", "RU"};
} |
Merci pour toute aide.
Bien à vous.
PS: J'ai éssayé d'uploader une image pour être plus explicite, mais mon compte imageshack est inacéssible.
http://img197.imageshack.us/img197/4...angues3.th.jpg