When loading a page, I have the following in my controller:
request.setAttribute("myAtt", "Testing");
I want to access this in my JSP file. In the HTML section, I am familiar with using things like:
${myAtt} ${requestScope.myAtt}
etc. However, I was never sure how to access the request parameters in JavaScript. I tried several things, for example:
var jsAtt = ${myAtt}; var jsAtt = '${myAtt}'; var jsAtt = eval(${myAtt}); var jsAtt = eval('${myAtt}');
etc. but nothing works.
Is there a way to capture request attributes via JavaScript? Please do not jQuery, servlets, etc. I want clean JavaScript code.
I'm kind of amazed, I did not find this already asked. So sorry if this is a duplicate, and I just did not see the original.
source share