One thing you might do in your abstract class is move the logic for
displaying the login screen to its own method.  This way child classes
can override the method if they want to display a custom login screen.

> All login-required servlets sub-class from an abstract class called
> LoginServlet, whose service() method does the following:
>         if login info (name&password) is in request, check the info
>                 if valid, store a Login object in Session & call super.service() 
>(which
> calls doGet/doPost)
>                 else, show a login screen
>         else if user is already logged in (i.e., there is a Login object in the
> Session), call super.service() (which calls doGet/doPost)
>         else, show a login screen
>
> The nice thing about sub-classing from LoginServlet is that it allows the
> specific servlets (and their authors) to concentrate only on their task w/o
> any need for understanding how login is done (the basic idea behind
> inheritance in general). All they know is that the login info is available
> from the Session's Login object, accessible via the static method
> Login.getLogin(HttpServletRequest).
>

___________________________________________________________________________
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