I have two kind of users: user and staff, I made seperated Servelt for both, user.java for user login, create user session, login, registration, etc. staff.java for staff login, create staff session, login but no registration If in java, staff.java can extends user, but in Servlet, I can't, as it have extends HTTPservlet already. So how can I do in OO way?
Thanks everyone who helped me
Joined: Oct 13, 2000
Have a single login servlet. User inputs user login credentials.(username,password?) if (valid credentials sent) Set status of user to logged in if (credentials are for a user) create user session (bean) forward to registration servlet/jsp else if (credentials are for staff) create staff session (bean) forward to ... You should investigate the MVC design pattern, you will find it useful not only with servlets but in other areas of your java programming. [ February 07, 2002: Message edited by: Graeme Brown ]
Author and all-around good cowpoke
Joined: Mar 22, 2000
General advice - don't try to do everything in the servlet class, make helper classes and use them. If the servlet class code is bigger than anything else in your project, it is time to refactor! If your doGet or doPost method is huge, it is time to refactor. Don't be shy about passing request and response objects to helper classes. JavaBeans style helper classes are your friends because if you need to write JSP they move right in. Bill