Hi

Why Should I extend the HttpServlet why Can't I have as follows






class Lecturer{

private String lecID;
private String lecname;

..

public void setname(String name_in){
...
}

....


}

the Lecturer class is saved seperately as lecturer.java


what I need is How can I call it within the servlet

that is how can I use above in the following it gives errors,(I need to
instantiate objects from the above class inside the following servlet)






import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;


public class admin2 extends HttpServlet{

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


}

lalith


At 11:32 AM 11/1/99 -0700, you wrote:
>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
>

___________________________________________________________________________
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