【发布时间】:2018-06-28 14:35:23
【问题描述】:
我正在使用运行 struts 1 的遗留系统。目前,我有嵌套的动作表单类,如下所示--
public class GrandParentForm extends BasicActionForm {
private ParentForm parentForm;
public GrandParentForm ()
{
parentForm = new ParentForm();
}
//Typical getters, setters, populate, validate, reset methods
}
public class ParentForm extends BasicActionForm {
private ChildForm childForm;
public ParentForm()
{
childForm = new ChildForm();
}
//Typical getters, setters, populate, validate, reset methods
}
public class ChildForm extends BasicActionForm {
private String childProperty;
public ChildForm(){}
//Typical getters, setters, populate, validate, reset methods
}
Struts Config -- GrandParentForm 在这里定义为一个 ActionFormBean,
<form-beans.....>
<form-bean name="grandParentForm" type="test.struts.action.pedigree.GrandParentForm " />
</form-beans>
<action-mappings ... >
<action path="/test/path/preparePedigree"
validate="false"
scope="request"
name="grandParentForm "
input="/main/pedigree/PedigreeList.jsp"
type="test.struts.action.pedigree.PreparePedigree">
<forward name="success"
path="/main/pedigree/PedigreeInformation.jsp" />
</action>
</action-mappings>
我的问题围绕着通过前端的 struts 标签评估这些表单的属性。
如果我使用 EL 语言 -- ${GrandParentForm.parentForm.childForm.childProperty}
它将检索适当的值。
但是对于 struts 表单元素内部的输入标签 --
<html:form .... >
<input type="text" id="test_id" name="parentForm.childForm.childProperty" .../>
</html:form>
名称不计算,它得到一个空的 parentform、childForm,然后是 null childProperty。
这是为什么呢?
【问题讨论】: