i hope you mean <% request.setAttribute("username", "user123"); %>
You can do this using JSTL EL,
or if userName is a request parameter.
but as Christophe said, try to avoid setting variables in request, session, application scopes inside JSP (instead use controller). If you want to create temporary variables inside jsp, create those in "page" scope (in c:set, simply dont mention "scope" attribute).