File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Extracting a value from the j_security_check servlet into a JSP page Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Extracting a value from the j_security_check servlet into a JSP page" Watch "Extracting a value from the j_security_check servlet into a JSP page" New topic
Author

Extracting a value from the j_security_check servlet into a JSP page

Varnam Aayiram
Ranch Hand

Joined: Dec 23, 2008
Posts: 88
Hi Folks...

I have a problem as follows:

I log in into the web app, via my login.jsp page. Below is the code for the form that accepts the login information



Login is sucessful and I am brought to the 'studentstub.jsp' page. I would like the user name to appear on the 'studentstub.jsp' page. I used the following code in the 'studentstub.jsp' page :


but all I am getting is a null. The 'j_security_check' servlet is not exactly part of my package, but the glassfish app server. Is there anything wrong in the way I am extracting the information from 'j_security_check' ? Hope someone can advise, thanks.
Devaka Cooray
Saloon Keeper

Joined: Jul 29, 2008
Posts: 2595

The getRemoteUser() method in HttpServletRequest returns the username of the authenticated user.


Author of ExamLab - the free mock exam kit for SCJP / OCPJP
Home Page -- Twitter Profile -- JavaRanch FAQ -- How to Ask a Question
Varnam Aayiram
Ranch Hand

Joined: Dec 23, 2008
Posts: 88
Hi Devaka Cooray..

Thanks for the reply, I appreciate it. I tried doing what you mentioned and it worked. I replaced this:



with this:



Thanks alot...
 
 
subject: Extracting a value from the j_security_check servlet into a JSP page
 
Threads others viewed
JDBCUserRealm question
URLConnection and form based authentication
problem in logout procedure
redirect from external page to tomcat 4 with forms based authentication
WARNING: Unexpected error forwarding to login page
developer file tools