• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

How to get the username cheked by j_security_check?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

@How do you do ? I hoppe well.
First of all I wanted to wish all users of this nice forum a happy new year!

I recently developp a webapp wiht security constraints settings. As you perhaps now it, it work with j_security_check on the
action-value of the form. The form hat two folders: a login-folder and a password-folder like use by j_security_check. That means
as names: j_username and j_paswword.

Now I want to get the loggin name of the logged user (on success). for some work on the next page
I tried:



But I allway got NULL on the string variable login !!!

Can anybody help me solve my problem?
 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello and a happy new year to you too.

Try to use in your next page (where you want to retrieve the user name) bellow code (if you use for example jsp):
<%= request.getUserPrincipal().getName() %>
This will retrieve the username that user inserted into the j_username field of login page.

Regards.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
request.getRemoteUser() also returns the user's name.
 
Gerry Mueller
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It works!

Thanks for your aswer.
reply
    Bookmark Topic Watch Topic
  • New Topic