as the title says. I got an object gotten from the Controller, on which one of its attributes is a List. Now i want to pass this List to an external file javascript function.
Something like this:
<a href="#" onClick="showAuthorityOverlay(<c:out value='${userDetail.grantedAuthorityList}'/>)">[SHOW AUTHORITY]</a>
Now the value passed to the javascript is something like this:
[ADMIN_USER, COMMON_USER]
So when i click in that link, i get a javascript error saying:
ADMIN_USER isn't defined.
What's wrong here? is it taking the ADMIN_USER and COMMON_USER as variable names? or what? Kinda weird.
Tried even making an inner script in my jsp to get the list like this:
<script type="text/javascript>
function showAuthorityOverlay() {
var obj = "<c:out value='${userDetail.grantedAuthorityList}'/>";
sendToExternalJSFile(obj);
}
</script>
But still getting the same results. Looks like the values aren't passing correctly through as a List parameter.
showAuthorityOverlay([ADMIN_USER, COMMON_USER]). Is this right, or maybe should beshowAuthorityOverlay('[ADMIN_USER, COMMON_USER]')?'when building theStringor using an EL function to add the'symbol from that input. I would recommend changing this at server side.