0

I'm working on a project and I have a problem. I send a parameter from a jsp page via forward to another jsp page and although it has the value that I declared (I printed it and it works), when I use it in an if clause the code doesn't work. Here is the part of the code:

String parameter = request.getParameter("loginparam");  //loginparam is the the name of parameter in the forward statement whick has value "now"

    if(parameter == "now"){
         prints the jsp page

    }else{

         response.sendRedirect("mainpage.jsp");
    }

It always redirects me in mainpage although when I print parameter it has the "now" value.

1 Answers1

1

Try with,

if(parameter.equals("now")){

And Read

Community
  • 1
  • 1
Rakesh KR
  • 6,357
  • 5
  • 40
  • 55