程序/qyrl/src/com/wy/tool/SelfRequestProcessor.java

(完整代码) 1KB

package com.wy.tool;//将该类保存到com.wy.tool包中

import java.io.UnsupportedEncodingException;//将java.io.UnsupportedEncodingException导入

import javax.servlet.http.HttpServletRequest;//将javax.servlet.http.HttpServletRequest导入
import javax.servlet.http.HttpServletResponse;//将javax.servlet.http.HttpServletResponse导入

import org.apache.struts.action.RequestProcessor;//将org.apache.struts.action.RequestProcessor导入
import org.springframework.web.struts.DelegatingRequestProcessor;//将org.springframework.web.struts.DelegatingRequestProcessor导入

public class SelfRequestProcessor extends DelegatingRequestProcessor {
	public SelfRequestProcessor() {//创建构造方法
	}

	protected boolean processPreprocess(HttpServletRequest request,
			HttpServletResponse response) {
	
		super.processPreprocess(request, response);//实现RequestProcessor类中的processPreprocess()方法
		
		try {
			request.setCharacterEncoding("gb2312");//将字符串编码格式转换为gb312
		} catch (UnsupportedEncodingException ex) {
			ex.printStackTrace();//在控制台中输出错误信息
		}
		return true;//通过return关键字返回boolean型数据
	}

}

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。