dimanche 24 janvier 2016

if blocks are never entered [duplicate]

This question already has an answer here:

I have a html page with 2 buttons with the same form action (When the user presses a button, the form redirects it to a servlet and then in that servlet, I want it to redirect to another html page based on the button pressed in the html page).

String name = request.getParameter("ID1");
String name2 = request.getParameter("ID2"); 

if( name == "ID1"){
    RequestDispatcher rs = request.getRequestDispatcher("index.html");
    rs.forward(request, response);
}
else if(== "ID2"){ 
    RequestDispatcher rs = request.getRequestDispatcher("changePassAdmin.html"); 
    rs.forward(request, response);
}

Aucun commentaire:

Enregistrer un commentaire