How can I pass a Javascript variable (String) directly to a bean method? When I'm trying the following, it doesn't work.
var dd = document.getElementById("j_idt2:ddcust");
var customer = dd.options[dd.selectedIndex].value;
var credit = document.getElementById("j_idt2:credit");
credit.value = #{creditController.getCreditScore(customer)};
However, if I hardtype my string into the method call (see below), it works.
var dd = document.getElementById("j_idt2:ddcust");
var customer = dd.options[dd.selectedIndex].value;
var credit = document.getElementById("j_idt2:credit");
credit.value = #{creditController.getCreditScore("Bau GmbH")};
But I don't want to hardcode. Where is my error here? Help would be appreciated!