java web中页面加载时执行函数的问题
4 回答

杨魅力
TA贡献1811条经验 获得超6个赞
类似session监听吗?
这个代码有现成的,你可以搜索一下,代码一般分2部分,java部分和javascript部分。
要考虑浏览器被强制关闭的情况,这种情况下不会触发beforeunload。需要在session销毁时做处理。

红颜莎娜
TA贡献1842条经验 获得超12个赞
web.xml中配置
<welcome-file-list> <welcome-file>redirect.jsp</welcome-file> </welcome-file-list>redirect.jsp中如下配置
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" isELIgnored="false"%><% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; response.sendRedirect(basePath+action);%>action为你要跳转的action
- 4 回答
- 0 关注
- 774 浏览
添加回答
举报
0/150
提交
取消