A.3 Custom 3.1 login.jsp File

To create this type of page, you need to start with the login.jsp that ships with Access Manager 3.1 and then add the required code for a header. Figure A-6 illustrates such a page.

Figure A-6 Custom Page Derived from the 3.1 login.jsp File

To create this page, see the following sections:

A.3.1 The Modified login.jsp File

This custom page does not modify the credential frame. The lines that define the window title (HHB CUSTOM LOGIN), the page header title (ITS A NEW WORLD), and the image (hhbimages.png) are marked in bold in the following sample file.

<%@ page language="java" %>
<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ page import="java.util.*" %>
<%@ page import="com.novell.nidp.*" %>
<%@ page import="com.novell.nidp.servlets.*" %>
<%@ page import="com.novell.nidp.resource.*" %>
<%@ page import="com.novell.nidp.resource.jsp.*" %>
<%@ page import="com.novell.nidp.ui.*" %>
<%
    ContentHandler handler = new ContentHandler(request,response);
    String target = (String)request.getAttribute("target");
    String hdrImage = "/custom_images/hhbimages.jpeg";

 %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//<%=handler.getLanguageCode()%>">
<html lang="<%=handler.getLanguageCode()%>">
   <head>
            <title>HHB CUSTOM LOGIN </title>
      <META HTTP-EQUIV="Content-Language" CONTENT="<%=handler.getLanguageCode()%>">
      <meta http-equiv="content-type" content="text/html;charset=utf-8">
             


      <style type="text/css" media="screen">
         

         td label       { font-size: 0.85em ; padding-right: 0.2em; }
         label       { font-size: 0.77em; padding-right: 0.2em; }
            input { font-family: sans-serif; }
         .instructions  { color: #4d6d8b; font-size: 0.8em; margin: 0 10px 10px 0 }
      </style>

      <script type="text/javascript" src="<%= handler.getImage("showhide_2.js",false)%>"></script>
      <script language="JavaScript">
         var i = 0;
         function imageSubmit()
         {
             if (i == 0)
             {
                i = 1;
                document.IDPLogin.submit();
             }
  
             return false;
         }
      </script>
      </head>
   <body text="lightcyan" style="background-color:Black" marginwidth="300" marginheight="100" leftmargin="350" topmargin="0" rightmargin="0" onLoad="document.IDPLogin.Ecom_User_ID.focus();" >
   <br>
         <h1><u>       IT’S A NEW WORLD</u></h1>
        
       <form name="IDPLogin" enctype="application/x-www-form-urlencoded" method="POST" action="<%= (String) request.getAttribute("url") %>" AUTOCOMPLETE="off">
         <input type="hidden" name="option" value="credential">
<% if (target != null) { %>
         <input type="hidden" name="target" value="<%=target%>">
<% } %>
            <table border=0 style="margin-top: 1em" width="20" cellspacing="0" cellpadding="0">
                               <tr>
                                   <div id="headimage"><img src="<%=handler.getImage(hdrImage,false)%>" alt="" height="80" width="150" border="0"></div>
                                             </tr>
                                        <tr>
                          
                                       <td style="padding: 0px">
                  <table border=0>
                  <br><br>

                     <tr>
                        <td align=center>
                           <label><%=handler.getResource(JSPResDesc.USERNAME)%></label>
                        </td>
                        <td align=center>
                           <input type="text" class="smalltext" name="Ecom_User_ID" size="30">
                        </td>
                     </tr>
                     <tr>
                        <td align=center>
                           <label><%=handler.getResource(JSPResDesc.PASSWORD)%></label>                  
                        </td>                   
                        <td align=center>
                           <input type="password" class="smalltext" name="Ecom_Password" size="30">
                        </td>
                     </tr>
                     <tr>
                        <td align=right colspan=2 style="white-space: nowrap">
                           <input alt="<%=handler.getResource(JSPResDesc.LOGIN)%>" border="0" name="loginButton2" src="<%= handler.getImage("btnlogin.gif",true)%>" type="image" value="Login" onClick="return imageSubmit()">
                        </td>                   
                     </tr>
                  </table>
               </td>
            </tr>
<%
    String err = (String) request.getAttribute(NIDPConstants.ATTR_LOGIN_ERROR);
    if (err != null)
    {
%>
               <td style="padding: 10px">
                  <div class="instructions"><%=err%></div>
               </td>
                     </tr>
<%  } %>
<%
   if (NIDPCripple.isCripple())
   {
%>        
               <tr>
                     <td width="100%" align="center"><%=NIDPCripple.getCrippleAdvertisement(request.getLocale())%></td>
               </tr>
<%
   }
%>
            </table>
         </form>
      </body>
</html>

A.3.2 The Method and the Contract

After modifying the file, you still need to create a method and a contract. The method needs to use a name/password class and have the following properties defined:

  • JSP property values:

    Property Name: JSP

    Property Value: <filename>

    Replace <filename> with the name of your custom login page. Do not include the JSP extension in the value.

  • MainJSP property values:

    Property Name: MainJSP

    Property Value: true

You then need to create a contract that uses this method and assign it to a protected resource.