Search code examples
jasper-reportsjasperserver

How to get the username of user who logged into Jasper Server?


Please tell me if there is any method through which I can get the user name of the user who logged into the Jasper Server, and that name could be displayed in the report.

Is there any parameter which can be referred or any other work around to obtain the logged in user name or any other way to deal with the issue.

Thanks in Advance!!


Solution

  • Try declaring a parameter with the name "LoggedInUsername" (this exact name, since it is reserverd by jasper to hold the username of the logged user).

    <parameter name="LoggedInUsername" class="java.lang.String" isForPrompting="false"/>
    

    and use it like $P{LoggedInUsername}.

    Note: this will only work on the server, not in iReport.