Un simple test avec JHMTL (calcul du résultat)


<% // Parameters come as strings String choice = request.getParameter("choice"); String choice2 = request.getParameter("choice2"); String nom = request.getParameter("nom"); out.println(nom + ", votre entrée était: question a=" + choice + " ,question b=" + choice2); // Integer.parseInt() translates a string to an Integer int score = Integer.parseInt(choice) + Integer.parseInt(choice2); out.println("

Votre score est de " + score + "/6

"); if (score < 3) { out.print ("

Vous êtes un débutant

"); } else if (score < 5) { out.print ("

Vous avez un niveau moyen

"); } else { out.print ("

Vous êtes un expert !

"); } %>
fr