cancel
Showing results for 
Search instead for 
Did you mean: 

Anonymous Group - IUserContext

Former Member
0 Kudos

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>
<%
}
%>

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

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());