This discussion is archived
1 Reply Latest reply: Jul 13, 2012 8:13 AM by 949347 RSS

How can we retrieve LDAP error code from a form based authentication ?

925694 Newbie
Currently Being Moderated
I would to display a well formatted message error when the login failed. It would be based on the LDAP code error returned by Active Directory.
So far oracle oc4j return either error or success. I dont know what kind of errors we have.

I have created a login page such as :

<form method="POST" action='<%= response.encodeURL("j_security_check") %>'>
<TABLE class="libParam">
          <TD>Utilisateur <strong class="libelleRouge"> <strong></TD>
          <TD><input type="text" name="j_username" size="32" /></TD>
          <TD>Mot de passe :<strong class="libelleRouge"> <strong></TD>
          <TD><input type="password" name="j_password" size="32" /></TD>
<TD class="libelleChampsObligatoires"><%=util.IDefine.LIBELLE_TOUS_CHAMPS_OBLIGATOIRES%></TD>
<TD colspan="2" align="right">
     <input type="submit" value="Valider" onclick="this.disabled=true;this.value='Patientez...';this.form.submit()">

When there is an authentication error the class ErrorLoginAction is thrown.
But I dont know how to get the type of errors from this class ?

public ActionForward doExecute(ActionMapping mapping, ActionForm form,HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
          return retourneAvecErreur("", "erreur.login.password", request, mapping, "erreurLogin");

In the OC4J log i got details of the type of LDAP error but i cannot display it in my login page of course.
How can I process the LDAP error from a struts class or the login.jsp page ?


Edited by: 922691 on 11 juil. 2012 23:30

Edited by: 922691 on 11 juil. 2012 23:30


  • Correct Answers - 10 points
  • Helpful Answers - 5 points