I may have the wrong idea of the relation of the JSF expression language to javaScript.
What I’m trying to do is nesting a bit of JSF EL in js in JSF EL. Which should look something like this:
<h:commandLink onclick="#{ condition ? 'jsFunction('#{bean.property}delimiter#{bean.prop2}')' :''}" action="...
obviously this does not work, so how do you nest a bit of JSF EL in js in JSF EL?
ps.: I know I could make two commandlinks and move the condition into the “rendered” attribute but I want to understand the relation of this conjunction.
You can’t nest EL expressions nor concatenate strings in EL expressions. You’ve also a JS syntax error by closing the function call with
}instead of).Prepare the nested expression beforehand with
<c:set>wherein you can just inline the desired expression in the resultant string value:This way you can just print it as follows: