Sample code: JSP file <% @ page contenttype = "text/html; charset=gb2312"%>
< HTML >
< Head >
< META&NBSP;HTTP-EQUIV = "Content-type" content = "text/html; charset=gb2312" >
< title > First pop-up message, then click OK to jump to the new address </title >
< the body >
<%
&NBSP;&NB Sp; string url = request.getparameter ("url");
string hasdays = Request.getparameter ("Hasdays");
%>
< Script type = "Text/javascript" >
alert ("system hint: your account is about to expire] [remaining" +&L t;%= hasdays%>+ "Days");
window.location.href = "<%=url%>";
</script >
System tip: Your account is about to expire!! Remaining <%= hasdays%> days;
<%
response.sendred Irect (URL);
%>
</body >
</HTML >
Originally hope that the above code implementation: first prompt will expire information, then click OK to jump to response.sendredirect point of address
However, because the Java code embedded in the JSP is executed on the server side, the execution effect of the above code can not satisfy the established function assumption,
There is no pop-up message, and the response.sendredirect! is executed directly.
In order to realize the above functions, we can only use JavaScript instead of Response.sendredirect to complete the address of the jump, the code is as follows:
<% @ Page ContentType = "text/html; charset=gb2312 "%>
< HTML >
< head >
< meta HTTP-EQUIV = "Content-type" Content = "text/html"; charset=gb2312 ">
< title > First pop-up message, then click OK and then jump to the new address </title >
< BODY >
<%
String url = request.getparameter ("url");
String hasdays = Request.getparameter ("Hasdays");
%>
< script type = "Text/javascript" >
Alert ("System hint: your account is about to expire] [remaining" +<%= hasdays%>+ "Day");
Window.location.href = "<%=url%>"; <!--JavaScript instead of Response.sendredirect do jump-->
</script >
System tip: Your account is about to expire, the remaining <%= hasdays%> days;
</Body >
</HTML >
Ok!! The problem is solved!!