JSP Error (original) (raw)

Hi, I've this JSP page that use a Collection to get the attributes' values. There is also a try/catch method in the code, which cause the JSP to be displayed as a blank page instead. I had wanted the [%=CM.getCourseID()%] and etc to be displayed. I believe that there is an exception hence causing the "system" to not display the items I want. I've tried looking through the codes but couldn't figure out where I went wrong. Can someone help? Thanks in advance.

<%@ page contentType="text/html; charset=iso-8859-1" language="java" %>

<%@ page import="alphapoly.CourseModule.Course.*, alphapoly.CourseModule.CourseManager.*, alphapoly.CourseModule.utility.*, javax.ejb.*, javax.rmi.*, java.math.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException, java.util.*" %>

<%! private CourseManager CourseManager = null;

public void jspInit() {

  try {

     InitialContext ic = new InitialContext();
     Object objRef = ic.lookup ("java:comp/env/ejb/CourseManager");
     CourseManagerHome home = (CourseManagerHome) PortableRemoteObject.narrow (objRef, CourseManagerHome.class);
     CourseManager = home.create();
  
  
  } catch (ClassCastException ex) {
         System.out.println("Couldn't create CourseManagerBean.123 " + ex.getMessage());
           
  } catch (RemoteException ex) {

        System.out.println("Couldn't create CourseManager bean."+ ex.getMessage());

  } catch (CreateException ex) {

        System.out.println("Couldn't create CourseManagerr bean."+ ex.getMessage());

  } catch (NamingException ex) {

        System.out.println("Unable to lookup home: "+ "CourseManager "+ ex.getMessage());
        
  } catch (Exception ex) {
      
          System.out.println("Other exceptions");

  }// End of Try and Catch Statements for jspInit ()

}// End of jspInit ()

public void jspDestroy () {

     CourseManager = null;

}// End of jspDestroy () %>

Alpha Polytechnic - Strive to Excel - Faculities


<%

// ############### JSP CODES STARTS HERE AGAIN ###############

try{ String faculty = "Chemical";

Collection collectionList =CourseManager.viewCourseByFaculty(faculty);

Iterator i = collectionList.iterator();
   while (i.hasNext()) {
            CourseModel CM = (CourseModel) i.next(); %>
            

%>

CourseID:


<%=CM.getCourseID()%>


Course Name:


<%=CM.getCourseName()%>

Faculty:


<%=CM.getFaculty()%>

Modules:


<%=CM.getModules()%>

....................................................

<%

            } //end while 

} // end try

catch(Exception e) {

System.out.println("This faculty has no courses at the moment.");
    

} // end catch

%>