How to do the console.log for EL expression in JS file
jQuery(document).ready(function() {
$('.js-bbCheckbox').click(function(event) {
var bbck = '${tagOne}';
console.log (bbck);
console.log (${tagTwo});
});
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To start, you need to understand that JSP (and JSTL and EL) basically produces HTML (and CSS and JS) code. It doesn’t run in sync with JavaScript code. If you rightclick the JSP page in webbrowser and do View Source then you’ll see it.
I think that your concrete problem is caused because the
${tagTwo}returns a plain vanilla string which is in turn by JS been interpreted as a variable name, because it isn’t been enclosed in quotes.You need to let JSP print a fullworthy JS string instead of a variable name.