login - How to fetch the username of a person logged into a JSP webapp using the memoryrealm? -


so have simple jsp web app running composed of several .jsp files, , protect using memoryrealm system asks username , password upon entering of .jsp pages, , remembers session, until browser closed. question is, how fetch username of person show him on 1 of pages?

p.s. running webapp on apache tomcat 7.0.35

// username.

string user = request.getremoteuser(); 

// user principal.

string userprincipal = request.getuserprincipal().getname(); 

// user in specific role? boolean isuserinrole = request.isuserinrole(role);

boolean isuserinjsprole = request.isuserinrole("jspuser"); 

from: http://sourceforge.net/apps/trac/ogsa-dai/wiki/faqhowtopasswordprotectjsppages


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -