ActionMapper 是干什么用的?

本文介绍了Struts2框架中的请求处理流程,包括ActionMapper的角色及其如何决定请求是否由Struts2处理,从配置文件中查找对应的Action,以及如何通过拦截器调用真正的Action并返回结果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

public abstract interface org.apache.struts2.dispatcher.mapper.ActionMapper {}
public abstract org.apache.struts2.dispatcher.mapper.ActionMapping getMapping(javax.servlet.http.HttpServletRequest arg0, com.opensymphony.xwork2.config.ConfigurationManager arg1);
public abstract org.apache.struts2.dispatcher.mapper.ActionMapping getMappingFromActionName(java.lang.String arg0);
public abstract java.lang.String getUriFromActionMapping(org.apache.struts2.dispatcher.mapper.ActionMapping arg0);
http请求,进入ActionContextCleanup(session,Attribute保留),走一些过滤器,filter,然后进入struts2 FilterDispatcher
然后进入ActionMapper,这个是用来判断请求是否 需要struts2处理,如果需要,那么由ActionProxy来接管,通过配置管理我们可以找到我们的struts.xml,然后进入真正做事的Action
Invocation,依次穿过我们的拦截器,进入action,从而根据返回的result选择我们要的页面,在拦截器的前半部分去值栈中取值通过标签展示在页面上,最后生成response返回
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值