cancel
Showing results for 
Search instead for 
Did you mean: 

hiding controls

timurso
Champ in-the-making
Champ in-the-making
Hi!
does anybody know, am I right here:

<%
<%!
  /** this function converts an array of cookies into a hashtable */
  Hashtable cookieTable(Cookie[] cookies) {
    Hashtable cookieTable = new Hashtable();
    if (cookies != null) {
      for (int i=0; i < cookies.length; i++)
        cookieTable.put(cookies[i].getName(), cookies[i].getValue());
    }
    return cookieTable;
  }
%>
<%!
  String isAdmin(HttpServletRequest request)
{
  String name = new String();
  Boolean isAdmin = new Boolean(false);
  Hashtable cookies = cookieTable(request.getCookies());

  if (cookies.containsKey("alfUser"))
  {
    name = (String)cookies.get("alfUser");
    if (name.indexOf("@")==-1)
    {
       isAdmin = true;
    }
  }
  return isAdmin;
}
%>
[…]
<a:booleanEvaluator value="<%isAdmin(request).toString()%>" id="evaluator">
   <h:outputText value="sometext" />
</a:booleanEvaluator>
[…]

this output text is not rendered as booleanEvaluator gets incorrect value! Java code itself is tested and is correct, but I'm suspicious about request parameter- maybe there are multiple requests and when booleanEvaluator is rendered, that request doesn't have specific cookie I'm looking for?
if I just put 
<%=isAdmin(request).toString%>
elsewhere, it gets correct value and if I'm logged in as admin, it shows correct boolean value!
1 REPLY 1

timurso
Champ in-the-making
Champ in-the-making
I presume it's because misunderstanding of "client side" and "server side" parts, but how could I solve it?