java struts1: переход от действия к действию с One ActionForm - PullRequest
0 голосов
/ 01 февраля 2011

Как я уже сказал в заголовке, у меня есть два действия (studentAction, UpdateStudentAction). Одно, форма действия: studentForm и конфигурация Struts, например:

<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 голосов
/ 17 марта 2011

да еще один способ - изменить значение атрибута перенаправления на false

...