Hi All
I am running a Struts-based intranet web application. Each user has a session object
called IQUser loaded. One of the methods of this object is hasRole(String roleKey).
Another is isAdmin() which calls hasRole("admin").
I wish to clean the JSP scriplet code I have everywhere ...
<%
if (user.hasRole("admin")) { %>
XYZ
<%
}
%>
with tag library calls. My first thought was that I need to create a custom tag
<iq:hasRole role="admin">
XYZ
</iq:hasRole>
Then I thought why not try to use JSTL, so I tried
<c:id test="{sessionScope.user.isAdmin}">
XYZ
</c:if>
to find that it did not work, and looking at references it seems that JSTL cannot do
method calls unless they are getXXX.
I do not want to set isAdmin as a boolean in some scope so that the following works
<c:id test="{requestScope.isAdmin}">
XYZ
</c:if>
because I find that messy when the user object exists in the session already.
It looks like I may have to go back to my original idea of a custom tag, but I wanted
to see what this list recommended first...I thought this would be straightforward
since calling boolean methods in beans with isXXX or hasXXX is as widespread as
getXXX.
Cheers, ADC
<FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE>
-------------------------------------------------------
QAS Ltd.
Developers of QuickAddress Software
<a href="http://www.qas.com">www.qas.com</a>
Registered in England: No 2582055
Registered in Australia: No 082 851 474
-------------------------------------------------------
</FONT>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]