Skip to Content
avatar image
Former Member

Anonymous Group - IUserContext

Hi,

in my JSP I try to find the language of the user and display it as shown below. When I make an iview out of it and assign it to a role further assigned to a user, whenever he changes the language from personalize the display is proper as depicted in the code.

But when I assign this to a role and then to the "anonymous group" of users, it throws an error even when only the part of the code in italics exists in the JSP.

<i><b><%
IPortalComponentRequest currentRequest =(IPortalComponentRequest)pageContext.getAttribute(javax.servlet.jsp.PageContext.REQUEST); 
IUserContext iuc = currentRequest.getUser();
Locale lang = iuc.getLocale();
String n = lang.getDisplayName();
%></b></i><html>
<%
if (n.equalsIgnoreCase("English"))
{
%>
<b>ENGLISH</b>
<%
}
else
{
%>
<b>NOT ENGLISH</b>
<%
}
%>

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • avatar image
    Former Member
    Oct 17, 2006 at 04:54 AM

    An update on this:

    When I echoed the user name it shows me guest even if I use named anonymous users using guest_user=XYZ or ABC

    And Guest has no locale so it throws an error. So what can I do regarding this, I need to find out the locale of the named anonymous users and display the language.

    IPortalComponentResponse currentResponse =(IPortalComponentResponse)pageContext.getAttribute(javax.servlet.jsp.PageContext.RESPONSE); IUserContext iuc = currentRequest.getUser();currentResponse.write("Hello "+iuc.getDisplayName());

    Add comment
    10|10000 characters needed characters exceeded