I'm working with a legacy system that runs struts 1. Currently, I have nested action form classes like the following --
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 is defined in here as a 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>
My question revolves around the evaluation of the properties of these forms via the struts tags on the front end.
If I use EL language -- ${GrandParentForm.parentForm.childForm.childProperty} it will retrieve the appropriate value.
However for an input tag inside of a struts form element --
<html:form .... >
<input type="text" id="test_id" name="parentForm.childForm.childProperty" .../>
</html:form>
The name doesn't evaluate, it gets an empty parentform, childForm and then null childProperty.
Why is that?
Figured out the problem, in my struts-config.xml I have multiple action entries that use this form. The final entry had scope session instead of request. Once I changed it to request the properties get resolved successfully.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.