<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<SCRIPT type="text/javascript">
function check() {
<!--     
window.history.forward(1);    
//window.location.replace(document.URL);    
  //window.open(document.URL,"_self","",true);  
  //-->       
}
</SCRIPT>

<body>
<a href="./login.jsp" onclick="check()">返回首页</a>
</body>
</html>这样写有用么?

解决方案 »

  1.   

    没用, history.go(-1)或location.href="*.html";
      

  2.   

    肯定是不对的,history.go(-1)或者是back只是返回上一页或者几页。
    如果想返回登录页面的话,<a href="jsp路径或者servlet路径"返回首页 </a>因为有个清空session的问题。这样你可以在指定的页面清空session再跳转,或者在servlet中清空再跳转 
      

  3.   

    指定servlet 的url跳转到首页 
      

  4.   

    没有用 你可以 写成 function check(){
       window. location.href='index.jsp'
    }
      

  5.   

    <a href="javascript:check()">返回</a>我接的好像a标签里面要调用javascript必须前面标记javascript:+函数名
    要不然是调不到的吧