作者TonyQ (骨头)
看板java
标题Re: [问题]JSP如何解决显示网页已经过期问题
时间Sat May 17 23:06:11 2008
※ 引述《kucom (kucom)》之铭言:
: 我做二个jsp网页 info.jsp及detail.jsp
: 当我点info.jsp里的某个栏位即可连结至detail.jsp 看该栏位的详细资料
: 现在问题是:当我连结至detail.jsp时,我欲返回info.jsp
: 网页则显示:"网页已经过期...balabala..."
: 这样很困扰 也不合理
: 因为这样我每次看完detail.jsp,欲再看其他资料时,就必须重新查询
: 我有在info.jsp及detail.jsp加下列的code,但仍会有网页已经过期的问题
: if ( request.getProtocol().compareTo("HTTP/1.0")==0)
: response.setHeader("Pragma","no-cache");
: else if ( request.getProtocol().compareTo("HTTP/1.1")==0)
: response.setHeader("Cache-Control" , "no-cache");
: response.setDateHeader("Expires",0);
: 有版友有这样的问题吗? 该如何解决?
: 感谢感谢~~~
这个是expire的时间已到
这个tag的意义参考一下这网页
http://www.i18nguy.com/markup/metatags.html
The date and time after which the document should be considered expired. An
illegal EXPIRES date, e.g.
"0", is interpreted as "now". Setting EXPIRES to 0
may thus be used to force a modification check at each visit.
Web robots may delete expired documents from a search engine, or schedule a
revisit.
简单来说expire这个header是设定到期的时间的,
假设设定0就表示阅读的那一刻就到期了,按上一页就会出现网页资讯已过期。
解决方法应该是把
response.setDateHeader("Expires",0);
给注解掉
这个expire主要是用在避免表单重复填写/送出用的,
另外也是避免有心人透过上一页去试着浏览机密资讯(如密码等)的措施。
--
I am a person, and I am always thinking .
Thinking in love , Thinking in life ,
Thinking in why , Thinking in worth.
I can't believe any of what ,
I am just thinking then thinking ,
but worst of all , most of mine is thinking not actioning...
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.134.27.68
1F:推 ecbytesan:YA 05/18 19:23
2F:推 kucom:谢谢TONY大...但我今天把它MARK起来RUN,仍显示网页过期>"< 05/22 22:25