UpdateAccount.jsp
Created with JBuilder
<%@ include file="Header.jsp" %>
<html>
  <head>
    <title>Ldap Authentication</title>
    <script language="JavaScript" type="text/JavaScript">
    <!--

    function checkForm(UpdateForm) {
      var ret = false;
      try {
        ret = checkUpdate(UpdateForm);
      }
      catch (error) {
        alert(error);
      }
      finally {
        return ret;
      }
    }

    function checkUpdate(UpdateForm) {
      var allowChar = /^[a-zA-Z]+[\-]*[a-zA-Z]*$/;
      var i = 0;

      if (UpdateForm.password.value == "") {
        UpdateForm.password.focus();
        throw("Please fill in password.");
      }

      if (UpdateForm.newPassword.value == "") {
        UpdateForm.newPassword.focus();
        throw("Please enter new password.");
      }

      if (UpdateForm.newPassword2.value == "") {
        UpdateForm.newPassword2.focus();
        throw("Please re-enter password.");
      }

      if (UpdateForm.firstName.value == "") {
        UpdateForm.firstName.focus();
        throw("Please enter first name.");
      }
      else {
        var allowFirstName = (UpdateForm.firstName.value).match(allowChar);

        if (allowFirstName == null) {
          UpdateForm.firstName.focus();
          throw("First name can only contains characters.");
        }
      }

      if (UpdateForm.lastName.value == "") {
        UpdateForm.lastName.focus();
        throw("Please enter last name.");
      }
      else {
        var allowLastName = (UpdateForm.lastName.value).match(allowChar);

        if (allowLastName == null) {
          UpdateForm.lastName.focus();
          throw("Last name can only contains characters.");
        }
      }

      if (confirm("Update information?")) {
        return true;
      }
      return false;
    }
    //-->
    </script>
  </head>
<body>
<p><img src="logo.gif"></img></p>
<hr>
<table id="ErrorMessageTable">
  <tr><td><font color="red"><c:expr value="$errorMessage"/></font></td></tr>
</table>
<p><h2>All Accounts</h2>
<table id="AllAccountsTable" border="1">
  <tr><th>
    <i>User name</i>
  </th><th>
    <i>First name</i>
  </th><th>
    <i>Last name</i>
  </th></tr>
  <c:forEach var="element" items="$accountsIterator">
    <tr><td>
      <c:expr value="$element.userName"/>
    </td><td>
      <c:expr value="$element.firstName"/>
    </td><td>
      <c:expr value="$element.lastName"/>
    </td></tr>
  </c:forEach>
</table>

<hr>
<form id="UpdateForm" method="post" action="controller" onSubmit="return checkForm(this)">
<input type="hidden" name="CommandName" value="UpdateAccount">
  <table border="0" width="276">
    <tr>
      <td width="122">User Name</td>
      <td width="144"><c:expr value="$userName"/></td>
      <input type="hidden" name="userName" value="<c:expr value='$userName'/>">
    </tr>
    <tr>
      <td width="122">Password</td>
      <td width="144">
        <input type="password" name="password">
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <h3>Update Information</h3>
      </td>
    </tr>
    <tr>
      <td width="122">Enter Password</td>
      <td width="144">
        <input type="password" name="newPassword">
      </td>
    </tr>
    <tr>
      <td width="122">Re-enter Password</td>
      <td width="144">
        <input type="password" name="newPassword2">
      </td>
    </tr>
    <tr>
      <td width="122">First Name</td>
      <td width="144">
        <input type="text" name="firstName" value="<c:expr value='$firstName'/>">
      </td>
    </tr>
    <tr>
      <td width="122">Last Name</td>
      <td width="144">
        <input type="text" name="lastName" value="<c:expr value='$lastName'/>">
      </td>
    </tr>
    <tr>
      <td colspan="2">
        <div align="center">
          <input type="submit" name="Update" value="Update">
        </div>
      </td>
    </tr>
  </table>
</form>
<a id="LogoutLDAP" href="controller?commandName=Logout">Logout</a>
<%@ include file="Footer.jsp" %>


UpdateAccount.jsp
Created with JBuilder