在struts框架的web程序中,http请求服务器,struts执行的全过程

个人用过一段时间的struts,服务器用的是tomcat,但是对它的执行原理并不熟悉,只知道大概一些。请baidu上的高手指点一下我给50分,如果说的好,我可以再加分。我... 个人用过一段时间的struts,服务器用的是tomcat,但是对它的执行原理并不熟悉,只知道大概一些。
请baidu上的高手指点一下
我给50分,如果说的好,我可以再加分。
我的意思是问struts在http请求到服务器的时候,struts具体的执行过程,比如说调用了actionservlet的方法,然后,去执行action。
展开
 我来答
旅波闭1536
2007-03-28 · 超过19用户采纳过TA的回答
知道答主
回答量:49
采纳率:0%
帮助的人:51万
展开全部
是这样的,在应用服务器启动的时候,就会根据struts-config.xml配置文件在内存中创建相应的bean。这样,当用户访问例如x.do的时候,首先会将请求交给actionservlet,actionservlet把请求转发给RequestProcessor,由RequestProcessor根据请求的uri来转发请求给action,在请求到达action之前会做一个formbean的填充,如果配置了验证,还会在填充后调用验证方法,如果不成功直接返回到struts-config.xml中的<action>中配置的input配置的地方,如果成功,则执行action的execute方法。

完毕。
累死了。
烟雨江南霜
2007-03-28 · TA获得超过401个赞
知道小有建树答主
回答量:290
采纳率:100%
帮助的人:154万
展开全部
Struts只是一个MVC框架(Framework),用于快速开发Java Web应用。Struts实现的重点在C(Controller),包括ActionServlet/RequestProcessor和我们定制的Action,也为V(View)提供了一系列定制标签(Custom Tag)。但Struts几乎没有涉及M(Model),所以Struts可以采用JAVA实现的任何形式的商业逻辑。
Spring是一个轻型容器(light-weight container),其核心是Bean工厂(Bean Factory),用以构造我们所需要的M(Model)。在此基础之上,Spring提供了AOP(Aspect-Oriented Programming, 面向层面的编程)的实现,用它来提供非管理环境下申明方式的事务、安全等服务;对Bean工厂的扩展ApplicationContext更加方便我们实现J2EE的应用;DAO/ORM的实现方便我们进行数据库的开发;Web MVC和Spring Web提供了Java Web应用的框架或与其他流行的Web框架进行集成。
就是说可将两者一起使用,达到将两者自身的特点进行互补。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
paccer
2007-03-28 · TA获得超过920个赞
知道小有建树答主
回答量:1617
采纳率:100%
帮助的人:1352万
展开全部
A client requests a path that matches the Action URI pattern (1).
 The container passes the request to the ActionServlet.
 If this is a modular application, the ActionServlet selects the appropriate
module.
 The ActionServlet looks up the mapping for the path.
 If the mapping specifies a form bean, the ActionServlet sees if there is one
already or creates one (1.1).
 If a form bean is in play, the ActionServlet resets and populates it from the
HTTP request.
 If the mapping has the validate property set to true, it calls validate on
the form bean (1.2).
 If it fails, the servlet forwards to the path specified by the input property
and this control flow ends.
 If the mapping specifies an Action type, it is reused if it already exists or
instantiated (1.3).
 The Action’s perform or execute method is called and passed the instantiated
form bean (or null).
 The Action may populate the form bean, call business objects, and do whatever
else is needed (1.3.1-1.3.4).
 The Action returns an ActionForward to the ActionServlet (1.3.5).
 If the ActionForward is to another Action URI, we begin again; otherwise,
it’s off to a display page or some other resource. Most often, it is a JSP, in
which case Jasper, or the equivalent (not Struts), renders the page (2, 3).
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式