-
1. Re: Nested EL in .xhtml and s:hasRole hard-coding removal
matt.drees Aug 7, 2007 10:00 PM (in response to asookazian)Not sure if this will work, but you could look into using an el function to return the string. So, something like:
"#{s:hasRole(my:admin())}"
Of course, now you're "hard coding" a method name in a string, which is probably as difficult to refactor as the string itself. Personally, I think you're better off using a straight string. -
2. Re: Nested EL in .xhtml and s:hasRole hard-coding removal
asookazian Aug 8, 2007 4:52 AM (in response to asookazian)Well that's what I'm worried about (in case of refactoring, you'd have to make the reference change to 'admin' or whatever the role is in many xhtml files).
so is there no way around this? There's no solution for this in Seam 2.0?
ahem, Gavin, calling Gavin... -
3. Re: Nested EL in .xhtml and s:hasRole hard-coding removal
pmuir Aug 8, 2007 5:15 AM (in response to asookazian)No. It's not possible to access static values in EL (it probably should be). If you add a feature request to Seam JIRA, we might be able to get it into JBoss EL.
-
4. Re: Nested EL in .xhtml and s:hasRole hard-coding removal
asookazian Aug 13, 2007 4:11 PM (in response to asookazian)The work around to this problem is the following:
in the .xhtml file, use the following code for the restriction:
<!-- in place of s:hasRole restriction -->
<s:div rendered="#{authorizor.display}">
<s:button view="/CustomersEdit.xhtml"
id="edit"
value="Edit"/>
</s:div>
where authorizor is a SLSB and the method is isDisplay() that returns boolean. This works fine and removes the hard-coding that was used in the s:hasRole method param passed.