Write the reason why the el expression cannot be evaluated in the js file and the solution

  • 2020-03-30 01:02:09
  • OfStack

Today, in the js file, write el expression can not take the value (code as follows), baidu one turn, now summarized as follows:

1. Javascript is executed on the client side,EL is executed on the server side, and the server side executes before the client side, so it cannot get a value

2, to get the value of "${isLogin}", you can receive it in JSP with a global variable and then use it in js

3, note: when using, note to add double quotes, such as var isLogin="${isLogin}";

var isLogin="${isLogin}"; 
//Not from the active page
else if(isLogin==='10001') 
}, 3000); 


Related articles: