struts学习

public void init() throws ServletException {
	initInternal(); // MessageResources, 初始化Struts框架内在的消息资源,如系统日志相关的通知、警告和错误消息
	initOther(); // ConvertUtils 注册
	initServlet();
	initChain();

	ModuleConfig moduleConfig = initModuleConfig("", config);
	initModuleMessageResources(moduleConfig);
	initModulePlugIns(moduleConfig);
	initModuleFormBeans(moduleConfig);
	initModuleForwards(moduleConfig);
	initModuleExceptionConfigs(moduleConfig);
	initModuleActions(moduleConfig);
	moduleConfig.freeze();
}

public void process(HttpServletRequest request, HttpServletResponse response)
	throws IOException, ServletException {
	// 上传
	request = processMultipart(request);
	// action.path
	String path = processPath(request, response);

	processLocale(request, response);
	processNoCache(request, response);
	processPreprocess(request, response);
	this.processCachedMessages(request, response);

	//找不到,就找Unknown的action mapping
	ActionMapping mapping = processMapping(request, response, path);

	processRoles(request, response, mapping);

	//scope里面查一下,没有就创建一个并写到scope里面去
	ActionForm form = processActionForm(request, response, mapping);
	//收集数据:reset()一下,把form表单的name、value(转化String[])塞到properties(HashMap),合适的convert一下,塞到formbean里面去
	processPopulate(request, response, form, mapping);
	//validate失败,就forward到action.input
	processValidate(request, response, form, mapping);
	//mapping.forward
	processForward(request, response, mapping);
	//mapping.include
	processInclude(request, response, mapping);
	//有就用,没就创建一个并保存
	Action action = processActionCreate(request, response, mapping);
	//执行了
	ActionForward forward =
		processActionPerform(request, response, action, form, mapping);

	//forward.path -> uri -> forward or redirect
	processForwardConfig(request, response, forward);
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值