I have two roles in my app, ROLE_ADMIN & ROLE_USER
Also I have a form with some fields. I would like to have the following:
When user has ADMIN role he is able to edit specific group of fields, when user has USER role he is not able to edit these fields. I don’t want to have two different forms, or two copies of fields for every role.
I tried to do something like that:
<s:textfield key=”…” disabled=”${myFlag}” >, where myFlag evaluated from roles.
But I have warning “disabled” does not support runtime expressions.
Is there any way to do this? Or maybe there’s better way, for example, by replacing generated input to label ?
Thanks in advance.
You should use the OGNL expression by
%{expression}syntax in a Struts2 tag.Doesn’t work with
%{myFlag}? Or you could set the the variable byImplementation :