A
A
Alena2017-05-11 11:50:44
Java
Alena, 2017-05-11 11:50:44

How to store the login of an authorized user in a variable?

Implemented authorization using JDBCRealm. Login and password are entered in login.jsp

<form action="j_security_check" method="POST">
            Авторизация
            <br/>
            Логин:<input type="email" name="j_username">
                <br/><br/>
                Пароль:<input type="password" name="j_password">
                    <br/><br/>
                    <input type="submit" value="Вход">                          
                        </form>

After authorization, go to the main.xhtml page.
It turns out to display the login of a registered user, but how to save it to a variable like?
Probably a stupid question, but I can't move on because of this problem :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alena, 2017-05-17
@SAlenaA

Found a slightly different way.
In java class:
private Object userLoginGo;
HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
userLoginGo = request.getRemoteUser();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question