了解struts2配置文件
下面的代码是在 struts-config 文件中编写的。但我无法理解它。
<action path="/showWelcome"
type="com.code.base.presentation.struts.actions.StrutsIoCAction"
name="LoanDetailPageLoadForm"
parameter="GET_WELCOME_PAGE"
input="welcomePage"
validate="false"
scope="request">
<set-property property="requestDTOKeyName" value="ItemDataRequest" />
<set-property property="responseDTOKeyName" value="ItemDataResponse" />
<set-property property="exceptionDTOKeyName" value="ProfileSekerException" />
<set-property property="businessServiceId" value="ItemsDataMgmtService" />
<forward name="success" path="welcomePage" />
<forward name="failure" path="sysError" />
</action>
我的问题是
path
属性的用法是什么?parameter
属性的用法是什么?input
属性有什么用?
有什么用?
帮帮我吧伙计们。
笔记: 根据我的理解,应用程序中应该有“showWelcome.jsp”页面,但它不存在。(那么它有什么用?)
The below piece of code was written in struts-config file.but i am not able to understand it.
<action path="/showWelcome"
type="com.code.base.presentation.struts.actions.StrutsIoCAction"
name="LoanDetailPageLoadForm"
parameter="GET_WELCOME_PAGE"
input="welcomePage"
validate="false"
scope="request">
<set-property property="requestDTOKeyName" value="ItemDataRequest" />
<set-property property="responseDTOKeyName" value="ItemDataResponse" />
<set-property property="exceptionDTOKeyName" value="ProfileSekerException" />
<set-property property="businessServiceId" value="ItemsDataMgmtService" />
<forward name="success" path="welcomePage" />
<forward name="failure" path="sysError" />
</action>
My question is
- what is the usage of
path
attribute? - what is the usage of
parameter
attribute? - what is the usage of
input
attribute? - what is the usage of
<set-Property>
?
Help me guys on this.
Note:
as per my understanding there should be "showWelcome.jsp" page in the application but it is not there.(then what is use of that?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
但是如果您要使用 struts 相当长的时间,QA 不会让您走得太远,请阅读有关 struts 配置文件的一些文档。
But if you're going to use struts for a considerable time, QA won't get you far, read some docs on struts' config file.
根据 @Alamar 的回复...
没有 showWelcome.jsp。 “/showWelcome”是 URL,但它与服务器上任何实际文件名不对应。如果此操作的配置包含如下行:
那么这意味着如果操作类 (StrutsIoCAction) 返回成功,则将执行名为 showWelcome.jsp 的文件。然而,正如您所看到的,实际的配置是转发到“welcomePage”,它可能不是一个文件,而是另一个操作的名称(也在 struts-config 中定义)。
注意:“forward”仅意味着执行被传递给其他操作,它并不意味着用户被重定向到另一个 URL。
Following on from @Alamar's response...
There is no showWelcome.jsp. "/showWelcome" is the URL, but that does not correspond to the name of any actual filename on the server. If this action's configuration contained a line like this:
Then it would mean that if the action class (StrutsIoCAction) returns success, a file called showWelcome.jsp would be executed. However, as you can see, the actual configuration is a forward to "welcomePage", which is probably not a file but instead the name of another action (also defined in struts-config).
Note: "forward" just means that execution is passed to this other action, it does not mean that the user is redirected to another URL.