Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use a JavaScript variable in an EL expression

Tags:

javascript

el

I am trying to archive very simple things but I'm not getting the expected result from the below script. I don't know what im going wrong.

<script>      
        var APP = "APPR";// in properties file APPR = Approved
        var message = "#{props["APP"]}";// JSF EL expression with resourcebundle 
        alert(message)// Want to print "Approved" but its printing ??APP???
</script>

Im using JSF resourcebundle and javascript.

like image 859
user1127643 Avatar asked Dec 03 '25 10:12

user1127643


1 Answers

try below

#{props['"+ APP + "']}
like image 68
Rocker9 Avatar answered Dec 04 '25 23:12

Rocker9



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!