hehe...I do init() as a matter of habit because Jason ingrained
that into me from the 1st Edition. Plus, I didn't believe that
he would create a class that did nothing but increment a counter.
You need a reference to the config object if you want to invoke
parameter methods on the servlet (unless the servlet directly
implements the javax.servlet.Servlet interface). But your
snippet does streamline the code he presented.
I don't know what's up with my email - I think it's my ISP. It's
been acting very screwing lately. I'll respond to myself on
SERVLET-INTEREST and take a look at the header. Thanks for the
heads-up.
Cheers!
Mark
----- Original Message -----
From: "Saumont Pierre-Yves" <[EMAIL PROTECTED]>
Sent: Friday, April 20, 2001 7:14 PM
> Hey Mark, why do you need to use init() when you can do :
>
> import java.io.*;
> import javax.servlet.http.*;
> import javax.servlet.*;
>
> public class CounterCons extends HttpServlet {
> int count = 1122;
> public void doGet(HttpServletRequest
req,HttpServletResponse res) throws
> IOException {
> PrintWriter out=res.getWriter();
> count++;
> out.println(count);
> }
> }
>
> That's not exactly the same, but it's probably close enough to
what he
> want's !
>
> BTW, Mark, how is your mail program configured ? Replies to
your messages
> are sent to you and not to the list. May be that's why you get
so many
> private questions !
>
> Pierre-Yves
>
>
> -----Message d'origine-----
> De : A mailing list for discussion about Sun Microsystem's Java
Servlet
> API Technology. [mailto:[EMAIL PROTECTED]]De la
part de
> balwinder singh
> Envoyé : samedi 21 avril 2001 00:01
> À : [EMAIL PROTECTED]
> Objet : Re: [Re: Servlets constructors]
>
>
> My question is :
> If I want to start my counter(see code below) with a default
value (say
> 1122)
> then if i use constructor of
> my servlet to do this, what is wrong with the code?why cant i
use
> construtor
> in this way in servlets?
>
>
>
> import java.io.*;
> import javax.servlet.http.*;
> import javax.servlet.*;
>
> public class CounterCons extends HttpServlet
> {
> int count;
>
>
> CounterCons(int i)
> {
> count=i;
> }
> public void doGet(HttpServletRequest
req,HttpServletResponse res) throws
> IOException
> {
> new CounterCons(1122);
> PrintWriter out=res.getWriter();
> count++;
> out.println(count);
> }
>
> }
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> "T.A. Flores" <[EMAIL PROTECTED]> wrote:
> So what exactly is your question?
>
>
> ----- Original Message -----
> From: balwinder singh <[EMAIL PROTECTED]>
> Date: Friday, April 20, 2001 2:03 pm
> Subject: Servlets constructors
>
> > Hi
> > I am new to Servlets and a lil curious about this question:
> >
> > The problem is:
> >
> > In JDK1.1 servlet Constructor were not allowed.But are
they
> > allowed in
> > JDK1.3?
> > If no,then why not? and if yes then pls give an example.
> > Regards
> > Balwinder Singh
> > web developer
> >
> >
> >
_________________________________________________________________
___
> > Get free email and a permanent address at
> > http://www.netaddress.com/?N=1
> >
>
_________________________________________________________________
_______
> ___
> > To unsubscribe, send email to [EMAIL PROTECTED] and
include in
> > the body
> > of the message "signoff SERVLET-INTEREST".
> >
> > Archives: http:
> > Resources: http://java.sun.com/products/servlet/external-
> > resources.htmlLISTSERV 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
>
>
>
_________________________________________________________________
___
> Get free email and a permanent address at
http://www.netaddress.com/?N=1
>
>
_________________________________________________________________
__________
> 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
>
___________________________________________________________________________
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