Where should I initialize the variable ?????
--- Kalman
----- Original Message -----
From: "Rishabh Agarwal" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, May 16, 2001 9:08 PM
Subject: Re: JSP Counter
> Hi,
>
> In this case it helps to decalare the variable as static. Also do not
> initialise the variable in the page.
>
> Rishabh.
>
> -----Original Message-----
> From: Sachin S. Khanna [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 16, 2001 12:57 PM
> To: [EMAIL PROTECTED]
> Subject: Re: JSP Counter
>
> One possible reason could be the restarting of the jvm on
> mycgiserver.com
> for some reason or the other and as far as my experience
> goes free servers
> donot provide private jvm for every free account as it
> doesnot make economic
> sense because of which you could be facing such a
behaviour.
> Hope this bit of info helps :-).
> Have a nice day.
> With regards,
> Sachin S. Khanna
> http://www.emailanorder.com
> ----- Original Message -----
> From: Kalman Hazins <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Wednesday, May 16, 2001 8:33 AM
> Subject: JSP Counter
>
>
> > Hi, all. I have a small problem.
> >
> > I got some free webspace at www.mycgiserver.com and
tried
> practicing
> writing
> > a JSP counter.
> >
> > This was my code:
> >
> > <% out.println("This page has been accessed ") ; %>
> > <%! int times = 0; %>
> > <% out.println(times++ + " times") ; %>
> >
> > So, it basically works. That is when I hit the "Refresh"
> button the # of
> > counts goes up. And sometimes even when I close the
> browser window and
> > reopen it again --- it shows the right count... BUT...
> every once in a
> while
> > I come back to the page ( a few hours later) and I see
> that a lot of times
> > the count starts from 0 again. What can the problem be
???
> >
> > --- Kalman
> >
> > P.S. The page I created was www.mycgiserver.com/~Kalman
> >
> >
>
>
===========================================================================
> > To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff
> JSP-INTEREST".
> > For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST
> DIGEST".
> > Some relevant FAQs on JSP/Servlets can be found at:
> >
> > http://java.sun.com/products/jsp/faq.html
> > http://www.esperanto.org.nz/jsp/jspfaq.html
> > http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> >
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
> >
>
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body:
> "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set
> JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets