C#技术百科
问问你的心你有没有信心 做事情要专一坚定,执着
package fiters; import javax.servlet.Filter; import javax.servlet.*; import java.io.IOException; import javax.servlet.http.*; public class ogFiters implements Filter{ public void init(FilterConfig parm1) throws ServletException { // TODO: Add your code here } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest hsRequest = (HttpServletRequest)request; HttpServletResponse hsResponse = (HttpServletResponse)response; request.setCharacterEncoding("gb2312"); response.setCharacterEncoding("gb2312"); /*HttpSession session = hsRequest.getSession(); //没登录 if(session.getAttribute("userName")==null) { String uri = hsRequest.getRequestURI(); //请求登录页面 if(uri.endsWith("login.html")|| uri.endsWith("login")) { chain.doFilter(request,response); } //请求其它页面 else { hsResponse.sendRedirect("login.html"); } } //登录成功 else { chain.doFilter(request,response); }*/ chain.doFilter(request,response); } public void destroy() { // TODO: Add your code here } } loginfilter fiters.ogFiters loginfilter *.do
posted on 2008-06-12 00:10  王德田  阅读(857)  评论(0编辑  收藏  举报