// 记住URL
UserVO user = (UserVO) session.getAttribute(Constants.SESSION_USER);
if (user == null ) {
String str = request.getRequestURL().toString();
String quryStr = request.getQueryString();
String url = str + " ? " + quryStr;
session.setAttribute( " url " , url);
}
// 获取URL
String redrectUrl = request.getParameter( " redUrl " );
// 检查是否存在有最后URL
if (redrectUrl != null &&! redrectUrl.equals( "" )) {
forward.setRedirect( true );
forward.setPath(redrectUrl);
return forward;
} else {
forward.setPath( " /index/home/index.do?oper=gotoHome " );
}
// v2.0
< script type = " text/javascript " >
var url = location.href;
$.ajax({
type: " POST " ,
dataType: " html " ,
url: contextPath + " /index/home/index.do?oper=savePageURL " ,
data: {
' url ' : url
},
success: function(data) {
}
});
</ script >
/**
* 保存浏览器显示URL
* @param mapping
* @param form
* @param request
* @param response
* @return
* @throws ParseException
*/
public ActionForward savePageURL(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws ParseException {
try {
String url = request.getParameter( " url " );
if (url != null &&! url.equals( "" )){
session.setAttribute( " url " , url);
}
} catch (AppException e) {
this .createActionMessage(request, e.getErrCode());
e.printStackTrace();
}
return null ;
}