[note: using v1.0.3] You cannot get a * (and probably other wildcards) out from a dynamically populated variable in <x: select statements. Using a string variable in a select predicate results in a properly escaped xpath statement. <c:set var="pred" value="clerk" /> <x:forEach select="$doc//employee[role=$pred]" > results in a select like "$doc//employee[role='clerk']" which is fine. BUT there is no way to specify wildcards like *. <c:set var="pred" value="*" /> <x:forEach select="$doc//employee[role=$pred]" > Appears to result in a select like "$doc//employee[role='*']" which is not correct.
The behavior you experience appears to be a limitation of XPath rather than a bug in our implementation of JSTL. Specifically, it does not appear that XPath will allow the evaluation of a variable to simply return a representation of the wildcard character * (without any surrounding quotes). If I am not mistaken, you'd run into the same issue with XSLT.
Perhaps I'm a bit dense here, but it seems to be the JSTL preprocessor that is at fault here. Surely the select statement: $doc//employee[role=$param:pred] must be preprocessed prior to sending to the XPath engine. Isn't the variable $param:pred completely unknown to the XPath engine? Obviously, I'm not familiar with the code, but neither was I aware that XPath would have any idea what to do with $param:pred.
No, the XPath language supports variables; the MEANING of those variables, when they're encountered in a JSTL page, is defined by JSTL, but the syntax is entirely XPath's.