Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

http 404 not found

SETH YOMBAFeb 24 2025

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Make your choice</title>
</head>
<body>
<h1>Choose your sign</h1>
<%
// L'ordinateur fait son choix en secret
String[] choixPossibles = {"Pierre", "Papier", "Ciseaux"};
String ordinateurChoix = choixPossibles[(int) (Math.random() * 3)];
%>

   \<form action="result.jsp" method="get">  
   \<!-- Le choix de l'ordinateur est caché -->  
   \<input type="hidden" name="ordinateurChoix" value="\<%= ordinateurChoix %>">  
     
   \<input type="radio" name="utilisateurChoix" value="Pierre" required> Pierre\<br>  
   \<input type="radio" name="utilisateurChoix" value="Papier"> Papier\<br>  
   \<input type="radio" name="utilisateurChoix" value="Ciseaux"> Ciseaux\<br>\<br>  
     
   \<button type="submit">Valider votre choix\</button>  

</form>
</body>
</html>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<title>Résultat</title>
</head>
<body>
<h1>Résultat du jeu :</h1>

<%
String ordinateurChoix = request.getParameter("ordinateurChoix");
String utilisateurChoix = request.getParameter("utilisateurChoix");

   String resultat = "";  
   if (utilisateurChoix.equals(ordinateurChoix)) {  
       resultat = "Égalité !";  
   } else if (  
       (utilisateurChoix.equals("Pierre") && ordinateurChoix.equals("Ciseaux")) ||  
       (utilisateurChoix.equals("Papier") && ordinateurChoix.equals("Pierre")) ||  
       (utilisateurChoix.equals("Ciseaux") && ordinateurChoix.equals("Papier"))  
   ) {  
       resultat = "Vous avez gagné !";  
   } else {  
       resultat = "Vous avez perdu !";  
   }  

%>

<p>Votre choix : <%= utilisateurChoix %></p>
<p>Choix de l'ordinateur : <%= ordinateurChoix %></p>
<h2><%= resultat %></h2>
<a href="index.html">Rejouer</a>
</body>
</html>

When i choose one of the options the code gives me http 404 not found, do you have an idea why?

Comments

Processing

Post Details

Added on Feb 24 2025
0 comments
66 views