资源简介
实验室设备管理系统
代码片段和文件信息
package cn.itcast.LabManagement;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
public class LoginFilter implements Filter {
public void doFilter(ServletRequest request ServletResponse response
FilterChain chain) throws IOException ServletException {
HttpServletRequest req = (HttpServletRequest) request;
object user = req.getSession().getAttribute(“sessionUser“);
if(user == null) {
req.setAttribute(“msg“ “请登录系统!“);
req.getRequestDispatcher(“/adminjsps/msg.jsp“).forward(req response);
} else {
chain.doFilter(request response);
}
}
public void init(FilterConfig fConfig) throws ServletException {
}
@Override
public void destroy() {
// TODO Auto-generated method stub
}
}
- 上一篇:Ucinet使用指南
- 下一篇:拓扑学基础及应用
评论
共有 条评论