RE: I don't want cached pages

2001-01-21 Thread Amos Shapira

Hi,

You can look at the generated code to understand what happens.

What happens is that "%!" (with "!") defines STATIC variables of the
servlet
instance.  Without the "!" the variables are automatic variables of
doGet/doPost.

Cheers,

--Amos


 -Original Message-
 From: Hugo Lara [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, January 20, 2001 2:53 AM
 To: 'Craig O'Brien'
 Cc: [EMAIL PROTECTED]; 
 [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: I don't want cached pages
 
 
 Craig,
 
 I want to thank you for your help. I tried the carts.html 
 example with the
 following results:
 - In my machine I added some articles to the cart. Then I 
 closed my browser
 and opened it again. When I ran the example and added 1 more 
 item, I noticed
 that all of the items I've added before where still in the cart, which
 didn't look nice to me.
 - Then I went to another computer and tried the same example. 
 I added 1 item
 to the cart and I was expecting to a list with the items I've 
 added in my
 computer, but I saw just 1 item. Which was perfectly fine.
 
 I opened the carts.jsp file and noticed that the bean they 
 where using had
 "session" as the parameter in "scope". Anyway, I didn't used 
 beans in my
 .jsp file (the one I had troubles with), but it made think it 
 wasn't the
 page that remained cached but the variables I was using, so I 
 reviewed my
 .jsp file and I found the problem:
 
 I was initializing my variables with something like this,
 
 %!
   String strOne = "", strTwo = "", strThree = "";
   Double dblNumber = 0.0;
   Locale currentLocale;
 %
 
 Then I used some java code to assign these variables some values and I
 expected that the variables where initialized each time I 
 called the .jsp
 file but it wasn't like that.
 
 Removing the "!" solved the problem. My variables are now 
 initialized like
 this,
 
 %
   String strOne = "", strTwo = "", strThree = "";
   Double dblNumber = 0.0;
   Locale currentLocale;
 %
 
 It's like if I use "%!" to initialize the variables, they 
 are initialized
 just the first time the page is called, and the subsequent 
 values assigned
 to them remain on the next requests to the page.
 Using only "%" seems to initialize the variables on each request.
 
 Do these ideas make any sense or I'm just to tired?
 
 I'm not really sure why this is working like this, but it's working!
 
 
 
 -Original Message-
 From: Craig O'Brien [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 19, 2001 5:39 PM
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Subject: RE: I don't want cached pages
 
 
 I cannot duplicate your problem.  Are you having the same 
 problem with the
 JSP example carts  
http://localhost:8080/jsp/sessions/carts.html ?  Are you
using Apache?  I am using IIS5 but am having no problems.  I have several
applications like you mention and I can open up multiple instances of the
same browser on the same machine and no information is passed between them.

You may try printing the session id to the screen to see if you are having a
problem there.  You could try specifying a non-persistent connection in the
JSP page, and next a non-persistent connection in the server.

Good luck,
Craig







-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 3:10 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: I don't want cached pages


I'm just one more guy with the same trouble: Tomcat is caching my pages.

I use a page that receives certain parameters and gives a result. And
everytime I made a request in the browser for that particular .jsp page, I
get the last version of that page served. It means that anyone entering my
site would see the last served paged with the results from the last visitor,
which is something terrible.

I've received some kind emails from the community suggesting me to include
the "Expires", "Pragma" and "Cache-control" (with the appropiate values) in
the header to avoid caching. This is not working, and that's because (and
I'm convinced of this) it's not a browser/proxy problem.
It is Tomcat that keeps the last version cached, and I'm sure of it because
it's enough to restart Tomcat to solve the problem.
Anyway, it will be crazy to restart Tomcat every time a visitor wants to
enter my site.

I've been reading the mailing and I've noticed there's a lot of people with
the same problem and no real solution.

I know that Amos Shapira and David S. Adress have been through the same.

If anyone has the solution to this problem please tell me, I need it very
badly.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: I don't want cached pages

2001-01-19 Thread Bill_Fellows/MO/americancentury



I'd do something insane like..

meta http-equiv="PRAGMA" content="NO-CACHE"

Not guaranteed to work for every browser and I can't remember what the other
thing you can set is, but if you did a search for the above tag in the search
engine of your choice I'm sure you'll be able to find more info.

/bill



Please respond to [EMAIL PROTECTED]; Please respond to
  [EMAIL PROTECTED]

To:   [EMAIL PROTECTED]
cc:(bcc: Bill Fellows/MO/americancentury)
Subject:  I don't want cached pages



I'm developing a website using Tomcat but I have a little problem.

I use a page that calls itself passing some parameters and based on the
parameters passed shows certain result.
The first time I call the page the URL looks like this:

http://myHost:21968/Demos/Formating.jsp

and I get the "original page"
After calling itself with a parameter, the URL look like this:

http://myHost:21968/Demos/Formating.jsp?parameter=123

and I get the "result page"
If I try to get the original page typing
http://myHost:21968/Demos/Formating.jsp in the browser, what I get is the
last page showing a result. It happens even if I call the page from a
different computer.

This is a serious problem because it means that someone accessing the site
for the first time, would see the result page generated by the parameters
passed by the last visitor instead of the original page.

The only way I've found to solve this is restarting Tomcat's service. Doing
so I won't get the result page but the original page.
But of course, I don't want to be restarting Tomcat's service everytime a
visitor wants to access the site.

Does anyone have a solution to this problem?




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: I don't want cached pages

2001-01-19 Thread Craig O'Brien

Add these two lines to your Servlet or JSP:

response.setHeader("Cache-Control", "no-cache");
response.setHeader("Pragma", "no-cache");

Not guaranteed to work in every browser.

Regards,
Craig


-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 11:12 AM
To: [EMAIL PROTECTED]
Subject: I don't want cached pages


I'm developing a website using Tomcat but I have a little problem.

I use a page that calls itself passing some parameters and based on the
parameters passed shows certain result.
The first time I call the page the URL looks like this:

http://myHost:21968/Demos/Formating.jsp

and I get the "original page"
After calling itself with a parameter, the URL look like this:

http://myHost:21968/Demos/Formating.jsp?parameter=123

and I get the "result page"
If I try to get the original page typing
http://myHost:21968/Demos/Formating.jsp in the browser, what I get is the
last page showing a result. It happens even if I call the page from a
different computer.

This is a serious problem because it means that someone accessing the site
for the first time, would see the result page generated by the parameters
passed by the last visitor instead of the original page.

The only way I've found to solve this is restarting Tomcat's service. Doing
so I won't get the result page but the original page.
But of course, I don't want to be restarting Tomcat's service everytime a
visitor wants to access the site.

Does anyone have a solution to this problem?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: I don't want cached pages

2001-01-19 Thread Ciot, Thierry



I 
found this somewhere (don't recall where) to prevent caching in the 
browser.

%response.setDateHeader("Expires", 
0);response.setHeader("Pragma", "no-cache");if ( 
request.getProtocol().equals("HTTP/1.1") ) 
response.setHeader("Cache-Control", "no-cache");%

If you 
tried accessing the page from a browser on 2 different machines and you are 
getting what you describe then it is not a browser caching problem but rather a 
pb on the server.

Thierry

  -Original Message-From: Hugo Lara 
  [mailto:[EMAIL PROTECTED]]Sent: Friday, January 19, 2001 
  2:12 PMTo: [EMAIL PROTECTED]Subject: I 
  don't want cached pages
  I'm developing a 
  website using Tomcat but I have a little problem.
  
  I use a page that 
  calls itself passing some parameters and based on the parameters passed shows 
  certain result.
  The first time I 
  call the page the URL looks like this:
  
  http://myHost:21968/Demos/Formating.jsp
  
  and I get the 
  "original page"
  After calling 
  itself with a parameter, the URL look like this:
  
  http://myHost:21968/Demos/Formating.jsp?parameter=123
  
  and I get the 
  "result page"
  If I try to get the original 
  page typing http://myHost:21968/Demos/Formating.jsp 
  in the browser, what I get is the last page showing a result. It happens even 
  if I call the page from a different 
computer.
  
  This is a serious problem because it means that 
  someone accessing the site for the first time, would see the result page 
  generated by the parameters passed by the last visitor instead of the original 
  page.
  
  The only way I've found to solve this is restarting 
  Tomcat's service. Doing so I won't get the result page but the original 
  page.
  But of course, I don't want to be restarting Tomcat's 
  service everytime a visitor wants to access the 
  site.
  
  Does anyone have a solution to this 
  problem?


RE: I don't want cached pages

2001-01-19 Thread Craig O'Brien

Mr. Coit is correct.

Is a proxy server involved?  Chances are your pages are being cached there.

Good luck,
Craig



-Original Message-
From: Ciot, Thierry [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 11:41 AM
To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
Subject: RE: I don't want cached pages


I found this somewhere (don't recall where) to prevent caching in the
browser.

%
response.setDateHeader("Expires", 0);
response.setHeader("Pragma", "no-cache");
if ( request.getProtocol().equals("HTTP/1.1") )
   response.setHeader("Cache-Control", "no-cache");
%

If you tried accessing the page from a browser on 2 different machines and
you are getting what you describe then it is not a browser caching problem
but rather a pb on the server.

Thierry
-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 2:12 PM
To: [EMAIL PROTECTED]
Subject: I don't want cached pages


I'm developing a website using Tomcat but I have a little problem.

I use a page that calls itself passing some parameters and based on the
parameters passed shows certain result.
The first time I call the page the URL looks like this:

http://myHost:21968/Demos/Formating.jsp

and I get the "original page"
After calling itself with a parameter, the URL look like this:

http://myHost:21968/Demos/Formating.jsp?parameter=123

and I get the "result page"
If I try to get the original page typing
http://myHost:21968/Demos/Formating.jsp in the browser, what I get is the
last page showing a result. It happens even if I call the page from a
different computer.

This is a serious problem because it means that someone accessing the site
for the first time, would see the result page generated by the parameters
passed by the last visitor instead of the original page.

The only way I've found to solve this is restarting Tomcat's service. Doing
so I won't get the result page but the original page.
But of course, I don't want to be restarting Tomcat's service everytime a
visitor wants to access the site.

Does anyone have a solution to this problem?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




Re: I don't want cached pages

2001-01-19 Thread JDunn

Why don't you unroll the loop ?
I assume that you want recursive calling to go only one level deep,
so copy the firstPahe.jsp to secondPage.jsp
They contain the same code .
firstPage calls secondPage.
It's probably safer also- no possibility of infinite loop if there
a bug.

If there's a lot of code - offload it into a servlet and call the servlet
from the jsp's.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: I don't want cached pages

2001-01-19 Thread Craig O'Brien

I cannot duplicate your problem.  Are you having the same problem with the
JSP example carts  http://localhost:8080/jsp/sessions/carts.html ?  Are you
using Apache?  I am using IIS5 but am having no problems.  I have several
applications like you mention and I can open up multiple instances of the
same browser on the same machine and no information is passed between them.

You may try printing the session id to the screen to see if you are having a
problem there.  You could try specifying a non-persistent connection in the
JSP page, and next a non-persistent connection in the server.

Good luck,
Craig







-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 3:10 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: I don't want cached pages


I'm just one more guy with the same trouble: Tomcat is caching my pages.

I use a page that receives certain parameters and gives a result. And
everytime I made a request in the browser for that particular .jsp page, I
get the last version of that page served. It means that anyone entering my
site would see the last served paged with the results from the last visitor,
which is something terrible.

I've received some kind emails from the community suggesting me to include
the "Expires", "Pragma" and "Cache-control" (with the appropiate values) in
the header to avoid caching. This is not working, and that's because (and
I'm convinced of this) it's not a browser/proxy problem.
It is Tomcat that keeps the last version cached, and I'm sure of it because
it's enough to restart Tomcat to solve the problem.
Anyway, it will be crazy to restart Tomcat every time a visitor wants to
enter my site.

I've been reading the mailing and I've noticed there's a lot of people with
the same problem and no real solution.

I know that Amos Shapira and David S. Adress have been through the same.

If anyone has the solution to this problem please tell me, I need it very
badly.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: I don't want cached pages

2001-01-19 Thread Craig O'Brien

This seems silly but, you wouldn't by chance be accessing static variables
in your JSP by chance would you?

Craig

Just throwing stuff out



-Original Message-
From: Craig O'Brien [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 3:39 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: I don't want cached pages


I cannot duplicate your problem.  Are you having the same problem with the
JSP example carts  http://localhost:8080/jsp/sessions/carts.html ?  Are you
using Apache?  I am using IIS5 but am having no problems.  I have several
applications like you mention and I can open up multiple instances of the
same browser on the same machine and no information is passed between them.

You may try printing the session id to the screen to see if you are having a
problem there.  You could try specifying a non-persistent connection in the
JSP page, and next a non-persistent connection in the server.

Good luck,
Craig







-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 3:10 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: I don't want cached pages


I'm just one more guy with the same trouble: Tomcat is caching my pages.

I use a page that receives certain parameters and gives a result. And
everytime I made a request in the browser for that particular .jsp page, I
get the last version of that page served. It means that anyone entering my
site would see the last served paged with the results from the last visitor,
which is something terrible.

I've received some kind emails from the community suggesting me to include
the "Expires", "Pragma" and "Cache-control" (with the appropiate values) in
the header to avoid caching. This is not working, and that's because (and
I'm convinced of this) it's not a browser/proxy problem.
It is Tomcat that keeps the last version cached, and I'm sure of it because
it's enough to restart Tomcat to solve the problem.
Anyway, it will be crazy to restart Tomcat every time a visitor wants to
enter my site.

I've been reading the mailing and I've noticed there's a lot of people with
the same problem and no real solution.

I know that Amos Shapira and David S. Adress have been through the same.

If anyone has the solution to this problem please tell me, I need it very
badly.


-
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: I don't want cached pages

2001-01-19 Thread Frederic Kam-Thong

This is what I use:


 response.setHeader("Cache-Control", "no-cache");
 response.setHeader("Pragma", "no-cache");
 response.setDateHeader("Expires", System.currentTimeMillis());
 response.setDateHeader("Last-Modified", System.currentTimeMillis());


The last line might be of help with browsers and proxies. (Then again, it
may not)
Hope it helps!

Frederic


-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 6:10 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: I don't want cached pages


I'm just one more guy with the same trouble: Tomcat is caching my pages.

I use a page that receives certain parameters and gives a result. And
everytime I made a request in the browser for that particular .jsp page, I
get the last version of that page served. It means that anyone entering my
site would see the last served paged with the results from the last visitor,
which is something terrible.

I've received some kind emails from the community suggesting me to include
the "Expires", "Pragma" and "Cache-control" (with the appropiate values) in
the header to avoid caching. This is not working, and that's because (and
I'm convinced of this) it's not a browser/proxy problem.
It is Tomcat that keeps the last version cached, and I'm sure of it because
it's enough to restart Tomcat to solve the problem.
Anyway, it will be crazy to restart Tomcat every time a visitor wants to
enter my site.

I've been reading the mailing and I've noticed there's a lot of people with
the same problem and no real solution.

I know that Amos Shapira and David S. Adress have been through the same.

If anyone has the solution to this problem please tell me, I need it very
badly.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: I don't want cached pages

2001-01-19 Thread Hugo Lara

Craig,

I want to thank you for your help. I tried the carts.html example with the
following results:
- In my machine I added some articles to the cart. Then I closed my browser
and opened it again. When I ran the example and added 1 more item, I noticed
that all of the items I've added before where still in the cart, which
didn't look nice to me.
- Then I went to another computer and tried the same example. I added 1 item
to the cart and I was expecting to a list with the items I've added in my
computer, but I saw just 1 item. Which was perfectly fine.

I opened the carts.jsp file and noticed that the bean they where using had
"session" as the parameter in "scope". Anyway, I didn't used beans in my
.jsp file (the one I had troubles with), but it made think it wasn't the
page that remained cached but the variables I was using, so I reviewed my
.jsp file and I found the problem:

I was initializing my variables with something like this,

%!
  String strOne = "", strTwo = "", strThree = "";
  Double dblNumber = 0.0;
  Locale currentLocale;
%

Then I used some java code to assign these variables some values and I
expected that the variables where initialized each time I called the .jsp
file but it wasn't like that.

Removing the "!" solved the problem. My variables are now initialized like
this,

%
  String strOne = "", strTwo = "", strThree = "";
  Double dblNumber = 0.0;
  Locale currentLocale;
%

It's like if I use "%!" to initialize the variables, they are initialized
just the first time the page is called, and the subsequent values assigned
to them remain on the next requests to the page.
Using only "%" seems to initialize the variables on each request.

Do these ideas make any sense or I'm just to tired?

I'm not really sure why this is working like this, but it's working!



-Original Message-
From: Craig O'Brien [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 5:39 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: I don't want cached pages


I cannot duplicate your problem.  Are you having the same problem with the
JSP example carts  http://localhost:8080/jsp/sessions/carts.html ?  Are you
using Apache?  I am using IIS5 but am having no problems.  I have several
applications like you mention and I can open up multiple instances of the
same browser on the same machine and no information is passed between them.

You may try printing the session id to the screen to see if you are having a
problem there.  You could try specifying a non-persistent connection in the
JSP page, and next a non-persistent connection in the server.

Good luck,
Craig







-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 3:10 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: I don't want cached pages


I'm just one more guy with the same trouble: Tomcat is caching my pages.

I use a page that receives certain parameters and gives a result. And
everytime I made a request in the browser for that particular .jsp page, I
get the last version of that page served. It means that anyone entering my
site would see the last served paged with the results from the last visitor,
which is something terrible.

I've received some kind emails from the community suggesting me to include
the "Expires", "Pragma" and "Cache-control" (with the appropiate values) in
the header to avoid caching. This is not working, and that's because (and
I'm convinced of this) it's not a browser/proxy problem.
It is Tomcat that keeps the last version cached, and I'm sure of it because
it's enough to restart Tomcat to solve the problem.
Anyway, it will be crazy to restart Tomcat every time a visitor wants to
enter my site.

I've been reading the mailing and I've noticed there's a lot of people with
the same problem and no real solution.

I know that Amos Shapira and David S. Adress have been through the same.

If anyone has the solution to this problem please tell me, I need it very
badly.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]




RE: I don't want cached pages

2001-01-19 Thread Ciot, Thierry

To understand why it is working that way the best thing is to look at the
generated java file (in the work directory).
Youy will see that when you use %!  the variables are defined at the java
class level
When you use % the variables are defined within the jspservice method (that
is they are local variables).

Thierry.

-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 7:53 PM
To: 'Craig O'Brien'
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: RE: I don't want cached pages


Craig,

I want to thank you for your help. I tried the carts.html example with the
following results:
- In my machine I added some articles to the cart. Then I closed my browser
and opened it again. When I ran the example and added 1 more item, I noticed
that all of the items I've added before where still in the cart, which
didn't look nice to me.
- Then I went to another computer and tried the same example. I added 1 item
to the cart and I was expecting to a list with the items I've added in my
computer, but I saw just 1 item. Which was perfectly fine.

I opened the carts.jsp file and noticed that the bean they where using had
"session" as the parameter in "scope". Anyway, I didn't used beans in my
.jsp file (the one I had troubles with), but it made think it wasn't the
page that remained cached but the variables I was using, so I reviewed my
.jsp file and I found the problem:

I was initializing my variables with something like this,

%!
  String strOne = "", strTwo = "", strThree = "";
  Double dblNumber = 0.0;
  Locale currentLocale;
%

Then I used some java code to assign these variables some values and I
expected that the variables where initialized each time I called the .jsp
file but it wasn't like that.

Removing the "!" solved the problem. My variables are now initialized like
this,

%
  String strOne = "", strTwo = "", strThree = "";
  Double dblNumber = 0.0;
  Locale currentLocale;
%

It's like if I use "%!" to initialize the variables, they are initialized
just the first time the page is called, and the subsequent values assigned
to them remain on the next requests to the page.
Using only "%" seems to initialize the variables on each request.

Do these ideas make any sense or I'm just to tired?

I'm not really sure why this is working like this, but it's working!



-Original Message-
From: Craig O'Brien [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 5:39 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: I don't want cached pages


I cannot duplicate your problem.  Are you having the same problem with the
JSP example carts  http://localhost:8080/jsp/sessions/carts.html ?  Are you
using Apache?  I am using IIS5 but am having no problems.  I have several
applications like you mention and I can open up multiple instances of the
same browser on the same machine and no information is passed between them.

You may try printing the session id to the screen to see if you are having a
problem there.  You could try specifying a non-persistent connection in the
JSP page, and next a non-persistent connection in the server.

Good luck,
Craig







-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 3:10 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: I don't want cached pages


I'm just one more guy with the same trouble: Tomcat is caching my pages.

I use a page that receives certain parameters and gives a result. And
everytime I made a request in the browser for that particular .jsp page, I
get the last version of that page served. It means that anyone entering my
site would see the last served paged with the results from the last visitor,
which is something terrible.

I've received some kind emails from the community suggesting me to include
the "Expires", "Pragma" and "Cache-control" (with the appropiate values) in
the header to avoid caching. This is not working, and that's because (and
I'm convinced of this) it's not a browser/proxy problem.
It is Tomcat that keeps the last version cached, and I'm sure of it because
it's enough to restart Tomcat to solve the problem.
Anyway, it will be crazy to restart Tomcat every time a visitor wants to
enter my site.

I've been reading the mailing and I've noticed there's a lot of people with
the same problem and no real solution.

I know that Amos Shapira and David S. Adress have been through the same.

If anyone has the solution to this problem please tell me, I need it very
badly.



-
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: I don't want cached pages

2001-01-19 Thread Craig O'Brien

Thierry is correct!!

When you use %!  you are inserting variables into the main body of the
servlet class, outside of the JSPService.  This is useful for "global"
counters and such but not for your use.

Take a look at your preferences in your browser.  I set my browsers to the
minimum cache and reload on every request.  That is more useful for testing.

Regards,
Craig

-Original Message-
From: Ciot, Thierry [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 5:03 PM
To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
Subject: RE: I don't want cached pages


To understand why it is working that way the best thing is to look at the
generated java file (in the work directory).
Youy will see that when you use %!  the variables are defined at the java
class level
When you use % the variables are defined within the jspservice method (that
is they are local variables).

Thierry.

-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 7:53 PM
To: 'Craig O'Brien'
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: RE: I don't want cached pages


Craig,

I want to thank you for your help. I tried the carts.html example with the
following results:
- In my machine I added some articles to the cart. Then I closed my browser
and opened it again. When I ran the example and added 1 more item, I noticed
that all of the items I've added before where still in the cart, which
didn't look nice to me.
- Then I went to another computer and tried the same example. I added 1 item
to the cart and I was expecting to a list with the items I've added in my
computer, but I saw just 1 item. Which was perfectly fine.

I opened the carts.jsp file and noticed that the bean they where using had
"session" as the parameter in "scope". Anyway, I didn't used beans in my
.jsp file (the one I had troubles with), but it made think it wasn't the
page that remained cached but the variables I was using, so I reviewed my
.jsp file and I found the problem:

I was initializing my variables with something like this,

%!
  String strOne = "", strTwo = "", strThree = "";
  Double dblNumber = 0.0;
  Locale currentLocale;
%

Then I used some java code to assign these variables some values and I
expected that the variables where initialized each time I called the .jsp
file but it wasn't like that.

Removing the "!" solved the problem. My variables are now initialized like
this,

%
  String strOne = "", strTwo = "", strThree = "";
  Double dblNumber = 0.0;
  Locale currentLocale;
%

It's like if I use "%!" to initialize the variables, they are initialized
just the first time the page is called, and the subsequent values assigned
to them remain on the next requests to the page.
Using only "%" seems to initialize the variables on each request.

Do these ideas make any sense or I'm just to tired?

I'm not really sure why this is working like this, but it's working!



-Original Message-
From: Craig O'Brien [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 5:39 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: I don't want cached pages


I cannot duplicate your problem.  Are you having the same problem with the
JSP example carts  http://localhost:8080/jsp/sessions/carts.html ?  Are you
using Apache?  I am using IIS5 but am having no problems.  I have several
applications like you mention and I can open up multiple instances of the
same browser on the same machine and no information is passed between them.

You may try printing the session id to the screen to see if you are having a
problem there.  You could try specifying a non-persistent connection in the
JSP page, and next a non-persistent connection in the server.

Good luck,
Craig







-Original Message-
From: Hugo Lara [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 19, 2001 3:10 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: I don't want cached pages


I'm just one more guy with the same trouble: Tomcat is caching my pages.

I use a page that receives certain parameters and gives a result. And
everytime I made a request in the browser for that particular .jsp page, I
get the last version of that page served. It means that anyone entering my
site would see the last served paged with the results from the last visitor,
which is something terrible.

I've received some kind emails from the community suggesting me to include
the "Expires", "Pragma" and "Cache-control" (with the appropiate values) in
the header to avoid caching. This is not working, and that's because (and
I'm convinced of this) it's not a browser/proxy problem.
It is Tomcat that keeps the last version cached, and I'm sure of it because
it's enough to restart Tomcat to solve the problem.
Anyway, it will be crazy to restart Tomcat every time a visitor wants to
enter