Chaitanya Gudala
Chaitanya Gudala

Reputation: 305

How to call j_security_check from within a servlet deployed on weblogic server

My HTML LOGIN Page

<html>  

    <head>  
        <title>FormBased Authentication Demo in WebLogic Sample</title>  
    </head>  

    <body bgcolor=maroon text=white>  
        <center>  
        <h2>Please Enter Your UserName & Password (FormBased Auth Example)</h2>  

        <form method="POST" action="j_security_check">          
            <table border=5%>           
                <tr>
                    <td>Username:</td>
                    <td><input type="text" name="j_username"></td>
                </tr>           
                <tr>
                    <td>Password:</td>
                    <td><input type="password" name="j_password"></td>
                </tr>           
                 <tr>
                    <td colspan=2 align=right><input type=submit value="Submit"></td>
                </tr>           
             </table>           
         </form>  

        </center>  
    </body>  

</html>

j_security_check is like a servlet provided by weblogic for implementing SQLAuthencticatoin.

Now I want to call the j_security_check servlet from within a servlet(my own custom servlet) as I need to execute some more code before routing it to j_security_check. Can anyone help me out ?

Upvotes: 1

Views: 2006

Answers (1)

Greg Ogreenc
Greg Ogreenc

Reputation: 21

j_security_check is used in Form-Based Authentication. So you can just do a POST to the j_security_check with "j_username" and "j_password". Typically this is done on a JSP, but it could be done within a servlet as well. This part probably isn't news, but as it is a little unclear what your particular issue is, I would recommend that you check out filters and listeners. If you have some code that you want to run through prior to a particular servlet gets called or preforms a particular action, implementing a listener might just do the trick. Conversely, if you care about managing various things prior to a session getting created, perhaps a filter would be useful.

Upvotes: 1

Related Questions