Java DynaActionForm和ActionForm之间有什么区别?
Java DynaActionForm和ActionForm之间有什么区别?,java,struts,struts-config,actionform,Java,Struts,Struts Config,Actionform,DynaActionForm和ActionForm之间有什么区别 有人说DynaActionForm并不是真正的动态,因为在重新配置struts config.xml文件中的属性后,您仍然必须重新启动服务器(否则将无法进行修改)如果ActionForm 每当用户添加控件时,我们都必须提供setter和getter。当用户创建视图时,相同的过程会重复一次又一次 但是,在使用DynaActionForm的情况下 它消除了这个负担,并创建了表单bean本身。这样,用户就不必编写setter和gette
DynaActionForm
和ActionForm
之间有什么区别
有人说
DynaActionForm
并不是真正的动态,因为在重新配置struts config.xml
文件中的属性后,您仍然必须重新启动服务器(否则将无法进行修改)如果ActionForm
每当用户添加控件时,我们都必须提供setter
和getter
。当用户创建视图时,相同的过程会重复一次又一次
但是,在使用DynaActionForm的情况下
它消除了这个负担,并创建了表单bean本身。这样,用户就不必编写setter
和getter
而DynaActionForm
不需要bean类,我们将表单bean声明为DynaActionForm
输入struts confing.xml
。我们将在struts config.xml
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
<!-- ========== Form Bean Definitions ================= -->
<form-beans>
<form-bean name="submitForm"
type="hansen.playground.SubmitForm"/>
</form-beans>
<!-- ========== Action Mapping Definitions ============ -->
<action-mappings>
<action path="/submit"
type="hansen.playground.SubmitAction"
name="submitForm"
input="/submit.jsp"
scope="request">
<forward name="success" path="/submit.jsp"/>
<forward name="failure" path="/submit.jsp"/>
</action>
</action-mappings>
</struts-config>
更新
struts config.xml
有两个部分:列出ActionForm bean的表单bean部分和操作映射部分。请求(MyActionForm.do
)到特定
Action和ActionForm类在struts-config.xml文件中完成