首页>代码>JSP+servlet开发在线投票统计管理系统源代码下载>/在线投票统计/11/src/com/filter/SubmitFilter.java
package com.filter;

import java.io.IOException;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

public class SubmitFilter implements Filter {
	private FilterConfig fc;

	public void doFilter(ServletRequest sRequest, ServletResponse sResponse,FilterChain chain) throws IOException, ServletException {
		HttpServletRequest request=(HttpServletRequest)sRequest;
		String method=request.getMethod();
		
		if(method.equalsIgnoreCase("POST"))
			chain.doFilter(sRequest,sResponse);	
		else{
			request.setAttribute("message","● 不是以POST方式进行的请求!<br>");				
			RequestDispatcher rd=request.getRequestDispatcher("fail.jsp");
			rd.forward(request,sResponse);
		}			
	}
	
	public void init(FilterConfig fc) throws ServletException {
		this.fc=fc;		
	}	
	public void destroy() {
		this.fc=null;
	}
}
最近下载更多
xiquyiyuan  LV10 4月24日
y_x_happy  LV4 2024年11月13日
泓鼎168  LV20 2024年6月5日
ming_123_9715  LV23 2022年11月27日
微信网友_6181845028360192  LV1 2022年10月19日
3273591624  LV6 2022年8月27日
evagsd  LV6 2022年7月8日
chengjuan  LV2 2022年6月29日
eniu_27  LV5 2022年5月30日
微信网友_5980754345857024  LV1 2022年5月30日
最近浏览更多
xiwaxiwa 昨天
暂无贡献等级
xiquyiyuan  LV10 4月24日
ma406805131  LV19 2024年12月18日
zolscy  LV24 2024年12月9日
chinajy  LV2 2024年12月8日
y_x_happy  LV4 2024年11月1日
taoshen95  LV16 2024年7月12日
柳咪华沙  LV7 2024年6月28日
泓鼎168  LV20 2024年6月5日
mxkyma 2024年5月13日
暂无贡献等级
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友