Re: Regarding support for tomcat server....................
At 02:47 PM 2/15/1996 +0530, you wrote: The above line shows a possible problem. Set your system date to 2001. It might be doing a time diff, and always think than an update is needed, hence a recompile. Hello Sir, I am Ravindra using tomcat 3.2.1 server in standalone mode for learning jsp . but problem is every time when i request for jsp page server is creating .java file & compiled it into class file . But this should not happened ,java file& class file should generate first time after change in jsp file . so i am facing problems for follwing counter.jsp example. when same jsp i am running through javawebserver2.0 it is working fine because java & class file is created after change in jsp only.not like previous case. Bellow i am giving code so please help me to solve the problem - <%@ page language="java" contentType="text/html" %> A page with a counter <%! int globalCounter = 0; %> This page has been visited: <%= ++globalCounter %> times. <% int localCounter = 0; %> This counter never increases its value: <%= ++localCounter %> - Thank you very much Regards Ravindra
RE: Regarding support for tomcat server....................
moreover because Servlet may be pooled in manyseparate instance, each servlet may have it's own counter... under low load it is not apparent, but if you load the server with many concurent accesss you will see that many different countes will be incremented separately... I've read somewhere that servlet should not have static variable (it could be a solution)... in fact in clustered servlet engine, there may be many independent JavaVM that may not share even the class variables. the solution is to use a singleton class through a middleware. one such way is to use a singleton Entity EJB ! sledge hammer to crack a nut! 8>>> welcome to the strange country of potential multi-threading, clustering and pooling ! if someone can explain me how to do it rigourously but much more simply... > -Message d'origine- > De: Rick Roberts [mailto:[EMAIL PROTECTED]] > Date: jeudi 15 février 2001 16:16 > À: [EMAIL PROTECTED] > Objet: Re: Regarding support for tomcat server > > > I don't know what's going on with your compile question, but > your code is > wrong. It should look like this: > > Take a close look at the ! (bang). > > <%! > int globalCounter = 0; > %> > > This page has been visited: <%= ++globalCounter %> times. > > > <%! > int localCounter = 0; > %> > NOW! This counter increases its value: <%= ++localCounter %> > > If you set a local variable to 0 everytime you run the code > then it's always > going to be 0. So it's never going to increment. Give > localCounter class > scope, just like you gave globalCounter class scope and it > will increment. > > Rick > > > > > On Thu, 15 Feb 2001, you wrote: > > > > Have you tried to disable browser cache? > > > > Attilio > > - Original Message - > > From: Ravindra > > To: [EMAIL PROTECTED] > > Cc: [EMAIL PROTECTED] > > Sent: Thursday, February 15, 1996 10:17 AM > > Subject: Regarding support for tomcat server > > > > > > Hello Sir, > > I am Ravindra using tomcat 3.2.1 server in standalone mode > > for learning jsp . > > but problem is every time when i request for jsp page server > > is creating .java file & compiled it into class file . > > But this should not happened ,java file& class file should > > generate first time after change in jsp file . > > so i am facing problems for follwing counter.jsp example. > > when same jsp i am running through javawebserver2.0 it > > is working fine because java & class file is created after > > change in jsp only.not like previous case. > > > > Bellow i am giving code so please help me to solve the > > problem > > > > > > > -- > - > >-- > > > > > > <%@ page language="java" contentType="text/html" %> > > > > > > A page with a counter > > > > > > <%! > > int globalCounter = 0; > > %> > > > > This page has been visited: <%= ++globalCounter %> times. > > > > > > <% > > int localCounter = 0; > > %> > > This counter never increases its value: <%= ++localCounter %> > > > > > > > > > > > > > -- > - > >-- > > > > Thank you very much > > > > Regards > > > > Ravindra > > > Content-Type: text/html; name="Attachment: 1" > Content-Transfer-Encoding: quoted-printable > Content-Description: > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, email: [EMAIL PROTECTED] > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
RE: Regarding support for tomcat server....................
I think his point was that neither one was showing any value other than 1, because the JSP was always recompiled, and then reloaded. Thus the class variable was being reset to 0 as the class was reladed. -Original Message- From: Rick Roberts [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 15, 2001 10:16 AM To: [EMAIL PROTECTED] Subject: Re: Regarding support for tomcat server I don't know what's going on with your compile question, but your code is wrong. It should look like this: Take a close look at the ! (bang). <%! int globalCounter = 0; %> This page has been visited: <%= ++globalCounter %> times. <%! int localCounter = 0; %> NOW! This counter increases its value: <%= ++localCounter %> If you set a local variable to 0 everytime you run the code then it's always going to be 0. So it's never going to increment. Give localCounter class scope, just like you gave globalCounter class scope and it will increment. Rick On Thu, 15 Feb 2001, you wrote: > > Have you tried to disable browser cache? > > Attilio > - Original Message - > From: Ravindra > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Sent: Thursday, February 15, 1996 10:17 AM > Subject: Regarding support for tomcat server > > > Hello Sir, > I am Ravindra using tomcat 3.2.1 server in standalone mode > for learning jsp . > but problem is every time when i request for jsp page server > is creating .java file & compiled it into class file . > But this should not happened ,java file& class file should > generate first time after change in jsp file . > so i am facing problems for follwing counter.jsp example. > when same jsp i am running through javawebserver2.0 it > is working fine because java & class file is created after > change in jsp only.not like previous case. > > Bellow i am giving code so please help me to solve the > problem > > > -- - >-- > > > <%@ page language="java" contentType="text/html" %> > > > A page with a counter > > > <%! > int globalCounter = 0; > %> > > This page has been visited: <%= ++globalCounter %> times. > > > <% > int localCounter = 0; > %> > This counter never increases its value: <%= ++localCounter %> > > > > > > -- - >-- > > Thank you very much > > Regards > > Ravindra Content-Type: text/html; name="Attachment: 1" Content-Transfer-Encoding: quoted-printable Content-Description: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Regarding support for tomcat server....................
I don't know what's going on with your compile question, but your code is wrong. It should look like this: Take a close look at the ! (bang). <%! int globalCounter = 0; %> This page has been visited: <%= ++globalCounter %> times. <%! int localCounter = 0; %> NOW! This counter increases its value: <%= ++localCounter %> If you set a local variable to 0 everytime you run the code then it's always going to be 0. So it's never going to increment. Give localCounter class scope, just like you gave globalCounter class scope and it will increment. Rick On Thu, 15 Feb 2001, you wrote: > > Have you tried to disable browser cache? > > Attilio > - Original Message - > From: Ravindra > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Sent: Thursday, February 15, 1996 10:17 AM > Subject: Regarding support for tomcat server > > > Hello Sir, > I am Ravindra using tomcat 3.2.1 server in standalone mode > for learning jsp . > but problem is every time when i request for jsp page server > is creating .java file & compiled it into class file . > But this should not happened ,java file& class file should > generate first time after change in jsp file . > so i am facing problems for follwing counter.jsp example. > when same jsp i am running through javawebserver2.0 it > is working fine because java & class file is created after > change in jsp only.not like previous case. > > Bellow i am giving code so please help me to solve the > problem > > > --- >-- > > > <%@ page language="java" contentType="text/html" %> > > > A page with a counter > > > <%! > int globalCounter = 0; > %> > > This page has been visited: <%= ++globalCounter %> times. > > > <% > int localCounter = 0; > %> > This counter never increases its value: <%= ++localCounter %> > > > > > > --- >-- > > Thank you very much > > Regards > > Ravindra Content-Type: text/html; name="Attachment: 1" Content-Transfer-Encoding: quoted-printable Content-Description: - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, email: [EMAIL PROTECTED]
Re: Regarding support for tomcat server....................
Have you tried to disable browser cache? Attilio - Original Message - From: Ravindra To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, February 15, 1996 10:17 AM Subject: Regarding support for tomcat server Hello Sir, I am Ravindra using tomcat 3.2.1 server in standalone mode for learning jsp . but problem is every time when i request for jsp page server is creating .java file & compiled it into class file . But this should not happened ,java file& class file should generate first time after change in jsp file . so i am facing problems for follwing counter.jsp example. when same jsp i am running through javawebserver2.0 it is working fine because java & class file is created after change in jsp only.not like previous case. Bellow i am giving code so please help me to solve the problem - <%@ page language="java" contentType="text/html" %> A page with a counter <%! int globalCounter = 0; %> This page has been visited: <%= ++globalCounter %> times. <% int localCounter = 0; %> This counter never increases its value: <%= ++localCounter %> - Thank you very much Regards Ravindra