hi everyone,
After an instructor logs in I am creating an
Instructors bean and then going to another servlet
called the AddAssignmentServlet. This is performtask
in the AddAssignmentServlet

HttpSession session=request.getSession(true);
                UserBean
userbean=(UserBean)session.getValue("userbean");
                InstructorselectionBean
ibean=(InstructorselectionBean)session.getValue("ibean");
                if(userbean==null || ibean==null)
                {
                        response.sendRedirect("/login.jsp");
                }
                ConnectionPool
cpool=(ConnectionPool)session.getValue("cpool");
                ibean.setCpool(cpool);
                ibean.getAllCourseAssignments();
                session.putValue("ibean",ibean);
                System.out.println("In AddAssignmentSevlet 2");


                String
assignmentname=request.getParameter("assignmentname");
                String duedate=request.getParameter("duedate");

                if(assignmentname==null || duedate==null)
                {
                        response.sendRedirect("/instructorselection.jsp");
                }
                else
                {

                        //InstructorselectionBean iselectbean=new
InstructorselectionBean();

                        ibean.setDuedate(duedate);
                        System.out.println("In AddAssignmentSevlet 1");
                        ibean.addAssignment(assignmentname);
                        System.out.println("In AddAssignmentSevlet 3");
                }



. Here I am using the ibean which is my beans
getAllCourseAssignment method which loads all the
assignments in a vector in in ibean itself.
However, for every assignmetn I am creating an
assignmet bean and putting that in a Vector.
this is in the ibeans getAllCourseAssignment method...


                System.out.println("In getAllCourseassignments");
                String query="Select name,duedate from assignments";
                Connection dbConn= cpool.getConnection();
                Statement stat=dbConn.createStatement();
                ResultSet rs=stat.executeQuery(query);
                System.out.println(query);
                cpool.returnConnection(dbConn);

                while(rs.next())
                {
                        String assignmentname=rs.getString("name");
                        String duedate=rs.getString("duedate");
                        assignmentvector.addElement(new
AssignmentBean(assignmentname,duedate));
                }




Now when I go to a JSP page and use the ibean and get
the vector and cast the objects as AssignmentBean
it gives me an error

<jsp:useBean id= "ibean" scope= "session" class=
"levelone.InstructorselectionBean" />
<jsp:useBean id= "userbean" scope= "session" class=
"levelone.UserBean" />
...
..

...

..

<%Vector v=(Vector)ibean.getAssignmentvector();%>
<%for(int i=0; i<v.size();i++)
{
        AssignmentBean abean=(AssignmentBean)v.elementAt(i);
%>
    <TR>
      <TD
width="215"><%=abean.getAssignmentname()%></TD>
      <TD width="137"><%=abean.getDuedate()%></TD>
      <TD><A href="/theme/grade">grade</A></TD>
      <TD><A href="/theme/delete">delete</A></TD>
    </TR>
<%}%>


please let me know whats going on here..i am
stumped..why doesnt it recognize

=====
** u are what u are :) **

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to