Description There are three JSP pages page1,page2,page3
Through the Page1 query to get Page2 page, through the Page2 page link to get page3 page
Now to back up, when the page3 back, you have to delete the following script in Page2, otherwise you will report that the page has expired
<%
Response.setheader ("Pragma", "No-cache");
Response.setheader ("Cache-control", "No-cache");
Response.setdateheader ("Expires", 0);
%>
2007-5-31 15:24 hope822
In the JSP page, when the Back button is clicked, the error of the page expiration or operation timeout is displayed.
I am using Java development of the Web site, the database is MySQL, I would like to ask, in the JSP page, the Point Back button, display page expiration or operation timeout errors,
In summary, the page content can not be returned to the previous page to continue the operation, the effect is how to do it.
Please expert advice, preferably have code, thank you.
2007-5-31 16:07 Celeron
Write at the top of the previous page
<%
Disable caching
Response.setheader ("Catch-control", "No-store");
Response.setheader ("Pramga", "No-catch");
Response.setdateheader ("Expires", 0);
%>
2007-5-31 16:23 hope822
Reply to #2 Celeron Post
Thanks, I'll go back and have a try at night. ;-)
2007-5-31 22:40 hope822
Reply to #2 Celeron Post
I tried, but it didn't work!
Let me say what I want to do:
I am now through the background of the landing interface into the background, when the point "exit", exit to the background landing interface. At this point, I click on IE browser Back button, but still can enter the background, continue to operate, this is certainly not what we want to get the effect.
Excuse me, after the exit, how to limit the "back" can no longer enter the background page, you can only login to enter.
If it's the code you're talking about, can you please elaborate on the location of code placement, I put it in the HTML, head, the body, these places have tried, seems to have not achieved results, but also please point out again; if not, please say one more way, thank you.
2007-5-31 23:40 Sinner
You didn't make it clear before, so that Celeron misunderstood.
Controlled by session.
When the user logs in, write the user information in the session and empty the session when exiting.
This allows you to know whether the current user is legitimate by judging the session on the action page.
2007-6-1 08:43 Celeron
Connect Sinner:
For example, after the login form is submitted to the page, write
<%
Session.setattribute ("admin", "1");//Send string variable admin to session, value "1"
%>
Then by linking or Response.sendredirect ("..... The name of the page to turn to ... "); turn to your background program page
Writing in the Background program page
<%
String admin = (string) session.getattribute ("admin");
if (admin!=null) {
Display what should be displayed after you log in here normally
}else{
There will be an error, not logged in or timed out, display the prompts and then automatically turn to the login page after n seconds
}
%>
2007-6-1 14:12 hope822
Reply to #6 Celeron Post
Thank you.
The problem has been solved.
This will show that the page has expired.
But how to make that backward memory function does not AH. Just can't order that back button.
Thank you, sir.
2007-6-1 14:15 hope822
Reply to #6 Celeron Post
This should be the way it should be done.
<%
Disable caching
Response.setheader ("Catch-control", "No-store");
Response.setheader ("Pramga", "No-catch");
Response.setdateheader ("Expires", 0);
%>
But I did not work.
Whether I put the wrong place, or what the problem.
2007-6-1 15:54 Celeron
Use disable caching to match session
The following two posts for your reference
[Url]http://bbs.blueidea.com/thread-701496-1-1.html[/url]
[Url]http://bbs.blueidea.com/thread-1556412-1-1.html[/url]
2007-6-1 21:21 hope822
Reply to #9 Celeron Post
It is now known to use the Disable cache to match sessions.
I set the success to 2 when I quit.
<c:if test= "${success = 2}" >
<div class= "Chaoshi" >
<a href= "<%=request.getcontextpath ()%>/admin/index.jsp" > Return, please click here </a>
</div>
But the code I used to disable caching did not work.
<%
Disable caching
Response.setheader ("Catch-control", "No-store");
Response.setheader ("Pramga", "No-catch");
Response.setdateheader ("Expires", 0);
%>
Now is the point back after you can also see the page display, only click the button after the page appears
You do not have permission, please go back to login!
What's wrong with me? Oh, thanks.
2007-6-2 12:51 hope822
Also please point again, here first thanks pull.
2007-6-2 13:18 asp910
You're doing it on the server side, and there's no request to the server when you go back.
The page you see may be cached in the temporary Internet files directory before the browser
Clean up the cache test.
In addition, the session right to judge the best place under the filter, and then configure the filter URL, so as to facilitate some
<% @page contenttype= "text/html;charset=gb2312" language= "Java"%>
<% @taglib uri= "/web-inf/ Struts-html.tld "prefix=" html%>
<% @taglib uri= "/web-inf/struts-bean.tld" prefix= "Bean"%>
<%@ Taglib uri= "/web-inf/struts-logic.tld" prefix= "logic"%>
<% @page import= " Com.fsti.doms.core.model.DOMSGlobalConstant "%>
<%
Response.setheader (" Pragma "," No-cache ");
Response.setheader ("Cache-control", "No-cache");
Response.setdateheader ("Expires", 0);
%>
<meta http-equiv= "Content-type" content= html charset=gb2312 ""
<link href= ". /css/style.css "type=" Text/css "rel=" stylesheet "
<script src=". /js/public.js "language=" JavaScript ></script>
<script language= "JavaScript src=". /js/checkall.js "></script>
<script language=" JavaScript "src=". /js/calendar.js "></script>
<script src= ' <%=request.getcontextpath ()%>/dwr/engine.js ' ></script>
<script src= ' <%=request.getcontextpath ()%>/dwr/util.js ' ></script>
<script src= ' <%=request.getcontextpath ()%>/dwr/interface/staffservice.js ' ></script>
<script src= ". /js/dwrutil.js "language=" JavaScript ></script>
<style>
body,table,td{
font-size:12px;
}
</style>
<script language= "JavaScript" >
function Showdiv ()
{
Document.all.mydiv.style.display= "None";
}
function Time_delay ()
{
SetTimeout ("Showdiv ();", 10000);
}
Function Searchstaff () {
var o = Window.event.srcElement.parentElement.parentElement;
window.document.all.rowNum1.value = o.rowindex;
Window.document.all.cellNum.value = window.event.srcelement.parentelement.cellindex;
window.open (' simplestaffsearch.jsp ', ', ', ' Scrollbars=yes,resizable=yes, Width=600,height=450,left=50,top=100 ');
}
function Checkdata () {
if (check (' C2 ')) {
if (Document.all.item.value = = "") {
Alert ("Please select the project number.") ");
return false;
}
If confirm ("The bill may need to be printed again, whether to determine the bulk item modification.") ")) {
Document.all.refer.value= ' is operating, please wait ... ';
Document.all.refer.disabled=true;
Document.theForm.submit ()
}}
else{
Alert (' Select the list to modify for the project information. ')
}
}
function init () {
var now = new Date ();
var year = Now.getyear ();
var month = Now.getmonth () + 1;
var date = Now.getdate ();
var hours = now.gethours ();
var minutes = now.getminutes ();
var seconds = now.getseconds ();
CurrentTime = "";
CurrentTime + + "-";
CurrentTime + + month + "-";
CurrentTime = date;
CurrentTime + = "";
St=currenttime;
if (document.theform)
document.theform.operdate.value=st;
}
</script>
<body onkeydown= "Shieldkey ()" oncontextmenu= "Rightkey ();" topmargin= "0" marginheight= "0" leftmargin= "0" Marginwidth= "0" onload= "init (); Time_delay ()" >
<table width= "100%" border= "0" cellpadding= "0" cellspacing= "0" height= ">"
<TR><TD class= "TITLEBAR1" > Project information Change list </td></tr>
<logic:notpresent name= "resultbilllist" scope= "Request" >
<TR><TD class= "Tipbar3" > Check no Data </td></tr>
</logic:notPresent>
</table>
<br/>
<div style= "Display:block" id= "mydiv" >
<logic:present name= "ALLSUCC" scope= "Request" >
<p class= "TIPBAR3" > Bulk project information changed successfully. </p>
</logic:present>
<logic:present name= "succ" scope= "Request" >
<p class= "TIPBAR3" > Material list operation was successful. </p>
</logic:present>
</div>
<logic:present name= "resultbilllist" scope= "Request" >
<form action= "batchmodifyitemforbillaction.do" method= "Get" name= "Theform" >
<table id= "Result" class= "Tablecolor1" cellspacing= "0" cellpadding= "3" width= "100%" align= "Center" >
<tbody>
<tr>
<th nowrap width= "3%" ><input type= "checkbox" Name= "C2all" onclick= "Checkall" (' C2 ', ' C2all ') "> select all </th >
<th nowrap width= "3%" > Serial number </th>
<th align= "center" width= "15%" nowrap> application Order number </th>
<th align= "center" width= "15%" nowrap> official single number </th>
<th align= "center" width= "17%" nowrap> application single Time </th>
<th align= "center" width= "8%" nowrap> applicant </th>
<th align= "center" width= "15%" nowrap> Project number </th>
<th align= "center" width= "15%" nowrap> project name </th>
<th align= "center" width= "15%" nowrap> Engineering team name </th>
<th align= "center" width= "12%" nowrap> Total amount </th>
<th align= "center" width= "15%" nowrap> material list status </th>
</tr>
<logic:iterate id= "Item" name= "Resultbilllist" scope= "request" indexid= "index" >
<tr Onmouseover=setcol1 (This) onmouseout=setcol2 (this) >
<TD align= "center" ><input type= checkbox "name=" C2 "value=" <bean:write name= "item" property= "billID"/ > "></td>
<TD align= "center" Nowrap><font color= "Red" ><%=index.intvalue () +1%></font></td>
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= "Billtype"/> "><bean:write name=" item "property=" Applycode "/></a></td>
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= "Billtype"/> "><bean:write name=" item "property=" Billcode "/></a></td>
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= "Billtype"/> "><bean:write name=" item "property=" Applydate "/></a></td>
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= "Billtype"/> "><bean:write name=" item "property=" Materialman.staffname "/></a></td>
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= billtype "/>" >
<logic:notempty name= "Item" property= "Item" >
<bean:write name= "Item" property= "Item.itemcode"/>
</logic:notEmpty>
</a></td>
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= billtype "/>" >
<logic:notempty name= "Item" property= "Item" >
<bean:write name= "Item" property= "Item.itemname"/>
</logic:notEmpty>
</a></td>
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= billtype "/>" >
<logic:notempty name= "Item" property= "Engineer" >
<bean:write name= "Item" property= "Engineer.engineername"/>
</logic:notEmpty>
</a></td>
<!--
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= billtype "/>" >
<logic:equal name= "Movebill" value= "Movebill" >
<logic:notempty name= "Item" property= "Outstorehouse" >
<bean:write name= "Item" property= "Outstorehouse.storehousename"/>
</logic:notEmpty>
</logic:equal>
<logic:notempty name= "Item" property= "Storehouse" >
<bean:write name= "Item" property= "Storehouse.storehousename"/>
</logic:notEmpty></a></td>
-->
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= billtype "/>" >
<script language= "JavaScript" >
document.write (Formatfloat (<bean:write name= "item" property= "sum"/>,2));
</script>
</a></td>
<TD align= "center" nowrap><a href= "Toshowbillforitemmodifyaction.do?billid=<bean:write name=" Item " Property= "billID"/>&billtype=<bean:write name= "Billtype"/> "><bean:write name=" item "property=" Currentstatus.statusname "/></td>
</tr>
</logic:iterate>
</tbody>
</table>
<table id= "billtable" class= "Tablecolor1" cellspacing= "0" cellpadding= "3" width= "100%" align= "Center" >
<tr>
<TD align= "Right" nowrap> project number:</td>
<TD nowrap>
<input type= "hidden" name= "item" value= "" >
<input type= "text" name= "ItemCode" value= "" ReadOnly size= ">
<input type= "button" class=sbtn1 value= "onclick=" window.open (' itemsearch.jsp ', ', ', ' scrollbars=yes,resizable =yes,width=800,height=500,left=50,top=100 ') "/><font class= ' Red ' > * </font>< /TD>
<TD align= "right" nowrap> project name:</td>
<td><input type= "text" name= "Itmename" value= "" size= "" ReadOnly size= "" ></td>
</tr>
<tr>
<TD align= "Right" nowrap> project manager:</td>
<TD nowrap>
<input type= "hidden" name= "Itemmanager" "value=" ">
<input type= "text" readonly name= "Itemmanagername" value= "" size= ">
<input type= "button" class=sbtn1 value= "onclick=" Searchstaff (); "Style= ' Cursor:hand"/></td>
</tr>
</table>
<p style= "margin-left:20px;" > <input name= "operdate" type= "text" size= "" onfocus= "Calendar ()" >
<input type= "button" Class=btn1 name= "refer" value= "Bulk Item Change" onclick= "Checkdata ();" ></p>
<input type= "hidden" name= "Billtype" value= "<bean:write name=" Billtype "/>" >
<input type= "hidden" name= "Billtypeid" value= ""/>
</form>
</logic:present>
<br/>
<input type= "hidden" name= "rownum" value= ""/>
<input type= "hidden" name= "RowNum1" value= ""/>
<input type= "hidden" name= "Cellnum" value= ""/>
</body>