structs初级问题

landog 03-04-03

我发现structs的例子(structs-example)中有action.xml,struct_config.xml,database.xml和web.xml等4个配置文件
而一般的例子中只有struct_config.xml,web.xml两个。我想只有这两个应该是必须的吧,那么系统是在哪里引用到action.xml呢?我没有找到

struct_config.xml有:
<#action path="/editRegistration"
type="org.apache.struts.webapp.example.EditRegistrationAction"
name="registrationForm"
scope="request"
validate="false">
<forward name="success" path="/registration.jsp"/>
<#/action>

而action.xml中有
<#action path="/editRegistration"
actionClass="org.apache.struts.webapp.example.EditRegistrationAction"
formAttribute="registrationForm"
formClass="org.apache.struts.webapp.example.RegistrationForm">
<forward name="success" path="/registration.jsp"/>
<#/action>

两个都在mapping里面,我不知道他们各自实现什么功能。我感觉差不多呢,有什么区别和联系呢》
初学structs,请大家帮忙,别耻笑。[

kkk9
2003-04-05 15:58

> 我发现structs的例子(structs-example)中有action.xml,s
> ruct_config.xml,database.xml和web.xml等4个配置文件
> 而一般的例子中只有struct_config.xml,web.xml两个。我想?> 有这两个应该是必须的吧,那么系统是在哪里引用到action.x
> l呢?我没有找到
>
> struct_config.xml有:
> <#action path="/editRegistration"
> type="org.apache.struts.webapp.example.EditRegistratio
> Action"
> name="registrationForm"
> scope="request"
> validate="false">
> <forward name="success"
> path="/registration.jsp"/>
> <#/action>
>
> 而action.xml中有
> <#action path="/editRegistration"
> actionClass="org.apache.struts.webapp.example.EditRegi
> trationAction"
> formAttribute="registrationForm"
> formClass="org.apache.struts.webapp.example.Registrati
> nForm">
> <forward name="success"
> ss" path="/registration.jsp"/>
> <#/action>
>
> 两个都在mapping里面,我不知道他们各自实现什么功能。我?> 觉差不多呢,有什么区别和联系呢》
> 初学structs,请大家帮忙,别耻笑。[


你看一下action.xml的开头注释说得很清楚:
!--
WARNING: This file is deprecated, and remains only as an example
of how the Struts configuration file would have been set up using
the conventions of Struts 0.5. All new development should be based
on Struts 1.0 standards, and you should be configuring the file
"struts-config.xml" instead.
-->