File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes j_security_check, Please help. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "j_security_check, Please help." Watch "j_security_check, Please help." New topic

j_security_check, Please help.

Justin Fluff

Joined: Apr 03, 2005
Posts: 2
How do i call this action programatically? I already have a login method in my action class, I wanna call this from there.

Please help asap.'j_security_check'
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

You'll need to tell us which app server you're using, some of them behave slightly differently.
The short answer is that you need to set up 'declarative security' in your web application by changing settings in your web.xml
Pavel Cherkashin
Ranch Hand

Joined: Mar 04, 2005
Posts: 47
May be this will help you.

Pavel Cherkashin - <br />SCJP, SCWCD, SCDJWS, SCBCD, SCEA, ...<br />
Thomas Hubschman
Ranch Hand

Joined: Sep 25, 2002
Posts: 88
Hi there,

To echo what David said, Web App containers (Tomcat and others) use a form of security called 'declaritive security.' What this means is that you 'declare' a web resource (servlet or jsp) to be inside your security perimeter usally in web.xml.
If an unauthenticated or unauthorized (two different things) user attempts to access that page (by clicking a link or typing in their URL bar) they get redirected to your login page or a login window pops up. After sucessful login they get forwarded to the original requested resource.

I hope that helps. I attached the code from the web.xml for the project I am currently working on.

I hope that is helpful.


SCJP '02, SCWCD '02, SCJD '08, SCSNB '09, SCEA '10
I agree. Here's the link:
subject: j_security_check, Please help.
It's not a secret anymore!