谁能解释一下 struts 应用程序中的请求-响应周期?
我正在开发一个基于 struts 的应用程序,但我经常遇到无法解析的请求或变量。
我认为这是因为我仍然不了解Struts应用程序的请求和响应周期。
有人可以帮我吗?
I am developing a struts based application but i regularly get stucked with the requests or variables unable to be resolved.
I think this is because i still don't understand the request and response cycle of the Struts application.
Can anybody help me out ??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里有很棒的解释,请浏览此链接
http://rollerjm.free.fr/pro/Struts11.html#2
基本上,struts 应用程序将在三个组件上运行
a) ActionServlet
b) struts-config.xml
c) 控制器
当用户通过 url 为 *.do 请求请求时,Actionservlet 将在 struts-config.xml 中查找该 .do 配置,您可以在“form-beans”和“action-mapping”标签中看到这些配置
首先,当用户请求“http/:....../user.do”时,您还可以在该“action-mapping”标签中看到该“user”,在该“action”标签下具有属性“path” 。
因此,当请求请求时,ActionServlet 将查找此属性。
之后它将检查名称属性“name=userform”。在此阶段,它将使用该名称查找是否存在包含与“name=userform”相同的名称属性的 form-bean。
所以你可以发现action标签名称属性和formbean标签名称属性是相同的。
识别后,它将通过将其发送到 Requestprocessor 来创建表单对象,并将请求植根于特定的操作类。
awesome explanation here please go throught this link
http://rollerjm.free.fr/pro/Struts11.html#2
Basically struts app will run on three components
a) ActionServlet
b) struts-config.xml
c) Controler
When an user request for an request by having url as *.do , Actionservlet will lookup of that .do configuration in struts-config.xml, you can see those in "form-beans" and "action-mapping" tags
First when user request for request as "http/:....../user.do" this "user" you can also see in that "action-mapping" tag, under this "action" tag with attribute "path" .
So ActionServlet will look for this attribute when ever an request is requested.
After that it will check the name attribute "name=userform". At this stage, it will look for with this name is there any form-bean containing same name attribute as "name=userform".
So you can find action tag name attribute and formbean tag name attributes are same.
after it identifies, it will create the form object by send it to Requestprocessor and roots the request to particaular action class.