Search code examples
javascriptjavajspscriptlet

javascript variable and scriptlet value is not matching


I am trying to match javascript variable value with value taken from scriptlet in jsp but even value are same I am not getting result true.

var a = 1;
console.log(a == <%=Constants.SOME_CONSTANT_VALUE%>);

Here value of Constants.SOME_CONSTANT_VALUE is "1" [String type] but I am getting console output as false.


Solution

  • try console.log(a == "<%=Constants.SOME_CONSTANT_VALUE%>");