java struts1:使用One ActionForm从动作转向动作

时间:2011-02-01 10:22:36

标签: java struts struts-1 actionform

就像我在标题中所说,我有两个动作(studentActionUpdateStudentAction)一个,动作形式:studentForm和struts-config如:

<action path="/student"
    type="action.StudentAction"
    name="studentForm"
    scope="request"
    validate="true"
    input="tiles.etudiant"
    parameter="dispatch">       
    <forward name="UpdateStudent"  path="/updateStudent.do" redirect="true" />  
</action>

<action path="/updateStudent"
    type="action.UpdateStudentAction"
    scope="request"
    name="studentForm"
    input="tiles.modifierEtudiant"
    parameter="dispatch">
</action>

重定向的第一个操作方法

public ActionForward onModifier(
        ActionMapping mapping,
        ActionForm form,
        javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response)
        throws DatabaseFailureException {       
StudentForm studentForm=(StudentForm)form;
return mapping.findForward("UpdateStudent");

}

第二行动方法(收件人):

public ActionForward onInitialiser(
        ActionMapping mapping,
        ActionForm form,
        javax.servlet.http.HttpServletRequest request,
        javax.servlet.http.HttpServletResponse response)
        throws DatabaseFailureException {

        StudentForm studentForm=(StudentForm)form;
        //etudiantForm.setIdEtudiantSelectionne("1");
        List listeCriteres=new ArrayList();
        listeCriteres.add(new SearchBean(new Etudiant().HQL_ID_ETUDIANT(), etudiantForm.getIdEtudiantSelectionne()));   etudiantForm.setListeEtudiants(getReferenceDataService().findListBoParCriteres(Etudiant.class, listeCriteres));

        return mapping.getInputForward();   }

**这是问题,第二个动作从第一个动作获得一个空表格**  我该如何解决这个问题?!

1 个答案:

答案 0 :(得分:0)

是的另一种方法是将重定向属性值更改为false&lt; forward name =“UpdateStudent”path =“/ updateStudent.do” redirect =“false” /&gt;