1.<a href= "javascript:history.back(); "> 返回 </a>
2.<%String ref = request.getHeader("REFERER");%>
<input type="button" name="returngo" value="/blog/返回上一页" οnclick="javascript:window.location='<%=ref%>'" >
struts Ation中的用法:
Jsp获取上一页的url
String url=request.getHeader("Referer");
返回上一页
mapping.findForward(url);
利用javascript:
public String jump( String jump)
{
String url=null;
if(jump=="back")
{
url="javascript:history.go(-1);\n"; //返回上一页
}
else if(jump=="home")
{
url="javascript:window.location.href='index.jsp';\n"; //返回首页
}
else if(jump=="")
{
url="";
}
else
{
url="javascript:window.location.href='"+jump+"';\n"; /返回指定页
}
String script_start="<script language=\"javascript\">\n";
String script_end="</script>";
String go=script_start+url+script_end;
return go;
}
2.<%String ref = request.getHeader("REFERER");%>
<input type="button" name="returngo" value="/blog/返回上一页" οnclick="javascript:window.location='<%=ref%>'" >
struts Ation中的用法:
Jsp获取上一页的url
String url=request.getHeader("Referer");
返回上一页
mapping.findForward(url);
利用javascript:
public String jump( String jump)
{
String url=null;
if(jump=="back")
{
url="javascript:history.go(-1);\n"; //返回上一页
}
else if(jump=="home")
{
url="javascript:window.location.href='index.jsp';\n"; //返回首页
}
else if(jump=="")
{
url="";
}
else
{
url="javascript:window.location.href='"+jump+"';\n"; /返回指定页
}
String script_start="<script language=\"javascript\">\n";
String script_end="</script>";
String go=script_start+url+script_end;
return go;
}