2011-02-01 19 views
0

就像我在標題所說轉發,我有兩個動作(studentActionUpdateStudentAction)一,操作方式:studentForm和的struts-config,如:的java struts1中:從行動對行動有一個ActionForm的

<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(); } 

**這裏是probleme,第二個動作從第一個得到一個空的形式** 我怎樣才能解決這個問題?!

+0

我不知道我是否正確的,但我只是修復它,通過更改範圍變爲會話,還有其他解決方案來正確地做到這一點? – dzgeek 2011-02-01 10:46:52

回答

0

是另一種方式是重定向屬性值更改爲假<着名=「UpdateStudent」路徑=「/ updateStudent.do」 重定向=「假」/>

相關問題