• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

How to get the username cheked by j_security_check?

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • 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
  • 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: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
request.getRemoteUser() also returns the user's name.
 
Gerry Mueller
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It works!

Thanks for your aswer.
 
what if we put solar panels on top of the semi truck trailer? That could power this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic