0

I'm Using two Actions in Apache Struts, one is DisplayAddPerson which forwards to AddPerson Action which uses a DynaValidatorActionForm to show a form page, on submit the data is persisted and ShowPersons Action is called.

<action path="/AddPerson" name="AddPersonForm" scope="request"
                    type="proj.actions.ManagePerson"
                    input="/DisplayAddPerson.do"
        parameter="create">
        <forward name="success" path="/ShowPersons.do" />
        <forward name="unauthorized" path="/Unautorized.do" />
</action>
<action path="/DisplayAddPerson" type="proj.actions.ManagePerson"
        parameter="displayAddPerson" validate="false">
         <forward name="success" path="AddPerson" />
        <forward name="unauthorized" path="/Unautorized.do" />
</action>

The above works well however DisplayAddPerson Action is useless because it simply points to a function displayAddPerson inside ManagerPerson.java which forwards to AddPerson.

Now I've tried to remove DisplayAddPerson Action and only use AddPerson action to shows a form and call itself on submit

however with the above the form is not shown and ManagePerson.create() is called without any form shown. How can I let AddPerson Action first show AddPersonForm and on submit call create() method and on success redirect to ShowPersons ?

Thank you

dendini
  • 3,842
  • 9
  • 37
  • 74

0 Answers0