<%
/*
 * Copyright (c) 1999-2000 BEA Systems, Inc.  All rights reserved
 *
 * THIS IS SOURCE CODE PUBLISHED FOR DEMONSTRATION PURPOSES
 *
 * This JHTML file illustrates how a University HTML client uses a servlet
 * to invoke operations on the WebLogic Enterprise University CORBA objects.
 */
%>

<%@ page import="
    com.beasys.Tobj.*,
    com.beasys.*,
    UniversityT.RegistrarFactory,
    UniversityT.RegistrarFactoryHelper,
    UniversityT.Registrar
"%>

<%
  // Code that is in the "service()" method.

  UniversityHelper univHelper= new UniversityHelper();

  try {
    // Get a connection from the pool which has been initialized 
    // at the web server startup.
    univHelper.univInit();
    // get the courses from the server
    UniversityT.CourseSynopsis[] listOfCourses = null;
    listOfCourses = univHelper.get_courses ("");

%>

    <html><head><title>List All Courses </title></head>
    <body>

    <center>
    <h4>List of All Courses</h4>

    <form name="registrar" action="/displayOrRegisterServlet.jsp" method="post">

    <select name="COURSE_NUM" size=10 >

<%
    for (int index = 0;index < listOfCourses.length; index++)
    {
      if (index == 0) {
%>

        <option selected value=<%=listOfCourses[index].course_number%>><%=listOfCourses[index].course_number%>:<%=listOfCourses[index].title%></option>
<%
      }
      else {
%>
        <option value=<%=listOfCourses[index].course_number%>><%=listOfCourses[index].course_number%>:<%=listOfCourses[index].title%></option>

<%
      }
    }
%>

    </select>
    <br><br>
    <input type="radio" checked name=COURSE_ACTION value="DISPLAY">Display Details
    <br>
    <input type="radio" name=COURSE_ACTION value="REGISTER"> Register
    <br> <br> <br>
    <input type="submit" value="GO">
    <p>
    Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    
    </center>
    </body></html>
<%
  }
  catch (Exception e)
  {
%>
    <html>
    <head><title>List All Courses - Error</title></head>
    <body bgcolor=#FFFFFF>
    <font face="Helvetica">

    <center>
    <h3>
    <font color='#FF0000'>
    System Error: <%=e.toString()%>
    </font>
    </h3>

    <form>
    <input type='button' value='Back' OnClick='history.go(-1)'>
    </form>
    <p>
    Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    </p>
    </center>
    </font>
    </body>
    </html>

<%
  }
%>
