# <ugm:getUserNames> Tag

The <ugm:getUsernames> tag retrieves a String array that contains the usernames matching the provided search expression. The search expression supports only the asterisk (*) wildcard character, and is case insensitive. As many asterisks as desired may be used in the search expression. This tag has no enclosed body.

Note: All User Management tags send results to the same file. If you are checking for results, include this import statement at the top of the page: <%@ page import="com.bea.p13n.usermgmt.taglib.UserManagementTagConstants" %>

## Syntax

<tagName attribute="value" />

## Attributes

atnProvider

Optional (String) - The name of the authentication provider to use. The default setting is the WebLogic Server DefaultAuthenticator. The authentication provider must provide write access. See Using Multiple Authentication Providers in Portal Development for more information.

searchExp

Optional (String) - The search expression to apply to the user name search. Defaults to `*'. Example: "t*".

userLimit

Optional (String, representing an int) - The maximum number of users to be returned from the search. (String which has a particular Integer.valueOf.) Defaults to 100. If user count exceeds userLimit, the length of the array in id is truncated to the length of userLimit. Example: "500".

id

Required (String) - A variable name to which the resultant user names are assigned. Example: "myUsers".

result

Optional (String) - The name of an Integer variable to which the result of the getUsernames operation is assigned.

Possible values:

- Success: UserManagerTagConstants.USER_SEARCH_OK.
- General error (such as a database connection failure that occurred during the search): UserManagerTagConstants.
  USER_SEARCH_FAILED.

If no users match the search criteria, then the result will not be equal to UserManagerTagConstants.USER_SEARCH_FAILED, but the length of the array returned in "id" will be zero.
Note: The USER_SEARCH_FAILED value is returned only when a general error occurs while searching for the user, such as a database connection failure. If no user matches the search criteria, the result will not be equal to UserManagementTagConstants.USER_SEARCH_FAILED, but the length returned by the array in id will be zero.

## Example

This example shows how to use <ugm:getUsernames> to retrieve a and print a username.

    <ugm:getUsernames userLimit="500" searchExp="t*" id="myUsers"/>
    <%System.out.println("I found " + myUsers.length + " users.");%>

Related Topics

<ugm:getUserNamesForGroup> Tag