public void doFilter(ServletRequest request, ServletResponse response,
			FilterChain chain) throws IOException, ServletException {
		String reg = request.getParameter("reg");
		HttpSession session = ((HttpServletRequest) request).getSession();
		try {
			if (!reg.equals("1")) {
				if (session.getAttribute("username") != null
						&& (!"".equals(session.getAttribute("username")))) {
					chain.doFilter(request, response);
					return;
				}
				((HttpServletResponse) response).sendRedirect("../userlogin.jsp");
				return;

			}
			chain.doFilter(request, response);

		} catch (Exception e) {
			chain.doFilter(request, response);
		}

		return;
	}