Lalith Jayaweera wrote:
>
> Hi everybody,
> In my project I have  classes written seperately such as
> (subject,deparment,lecturer,courses etc..) How can I instantiate the
> objects of these classes and call methods of these classes
> inside the servlet.
> Should I import all the classes I need or What?
>
> (Simply, How can deal with above classes inside the doGet method)

Simply, the same way you would inside any other Java class or method

//import the classes, not shown

public class SchoolServlet extends HttpServlet {
  //As class members
  private Subject[] subjects;
  private Department[] departments
  //etc.

  public School () {
    subjects = new Subject[NUMBER_OF_SUBJECTS];
    departments = new Department[NUMBER_OF_DEPARTMENTS];
  }

  //Inside a method
  public someMethod () {
    Subject subject = new Subject ("Calculus");
    subject.doSomething ();
    Department department = new Department ("Mathematics");
    department.doSomething ();
  }
}

___________________________________________________________________________
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