Sorry for not mention this: 
well, the web root context of my web app is "/fs". My login pages are in 
webcontent/login(equals to /fs/login).

I just used the /security/protected/*.jsp  from tomcat examples. The source 
code of the  login page is:

<html>
<head>
<title>Login Page for Examples</title>
<body bgcolor="white">
<form method="POST" action='<%= response.encodeURL("j_security_check") %>' >
  <table border="0" cellspacing="5">
    <tr>
      <th align="right">Username:</th>
      <td align="left"><input type="text" name="j_username"></td>
    </tr>
    <tr>
      <th align="right">Password:</th>
      <td align="left"><input type="password" name="j_password"></td>
    </tr>
    <tr>
      <td align="right"><input type="submit" value="Log In"></td>
      <td align="left"><input type="reset"></td>
    </tr>
  </table>
</form>
</body>
</html>

I confused that this code worked well with the example but failed in my case...

On Nov 30, 2010, at 12:04 PM, Caldarale, Charles R wrote:

>> From: long hong [mailto:longhong1...@gmail.com] 
>> Subject: authentication fail (JNDI Realm with Tomcat )
> 
>> <security-constraint>
>>  <web-resource-collection>
>>    <web-resource-name>Entire Application</web-resource-name>
>>    <url-pattern>/fs/*</url-pattern>
> 
> You probably want just /* in the above <url-pattern>; what you have now 
> protects only the path /fs *under* your webapp.  (Either that, or your 
> <web-resource-name> is very wrong.)
> 
>>    <auth-method>FORM</auth-method>
> 
> Easier to get things working with BASIC authentication first, then move on to 
> the FORM variant.
> 
> - Chuck
> 
> 
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY 
> MATERIAL and is thus for use only by the intended recipient. If you received 
> this in error, please contact the sender and delete the e-mail and its 
> attachments from all computers.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to