伪代码如下:
@RequestMapping(MAIN_VIEW)
public String mainView(HttpServletResponse response) throws Exception {
//声明属性
String usercode = ActivePersonManager.getActivePerson().getId();
String keyStr=usercode+"$$"+DateUtil.getDateNow("yyyyMMdd");
String tokenStr=EncryptUtil.encrypt(keyStr);
// String mainurl = "http://www.baidu.com?xt=dj&token="+tokenStr;
//跳转实现
PrintWriter out = response.getWriter();
//out.print("<script>window.location.href='"+mainurl+"';</script>");
out.print("<script>window.open('"+mainurl+"','_blank');</script>");//跳转出iframe框架,打开新tab页
out.flush();
return null;
}
java 通过js页面跳转实现
最新推荐文章于 2024-05-15 10:17:08 发布