I have a Registration page which has been splited into 4 JSP pages so, in this case shall i use only one ActionForm bean for this page, or shall i use 4 different ActionForm beans one for each JSP pages and what will be the scope of the ActionForm bean in action mappings.
You can use 1 ActionForm for all 4 forms. If you want to discuss some issues related to that then feel free to continue the discussion here.
Joined: Dec 07, 2005
so what will be the scope of the ActionForm bean if it is session will it be feasible.
Joined: Sep 21, 2005
It is very difficult to say because these all thing depends upon your project requirement. U can make scope of request because scope of session sometimes can give bit problem like when you come back to page again then it will show the previous values .... etc ..... as i face these problems.
And after all it depends on your requirement.
And if you want to discuss something about that then please feel free.
Joined: Dec 07, 2005
but if i set the scope to request will not the previous data get lost, as i will gather all the data only in one Action class , and for each page i have to submit different action in the JSP page/form.
It sounds like you are implementing a wizard like process. My project has implemented wizard pages in a few different ways. We have a general rule that all actions should be defined as scope="request" (though I see a handful of cases where developers have violated this rule...mostly for what looks like wizard pages).
If you only have a few fields on your pages, you can keep the form as request and store all the values from previous pages as hidden fields on your jsp. Not the best solution, but workable. This seems to fit best with the validator framework, since I think it validates all fields on the current page and all previous pages...or maybe it expects that you are using session scope.
I created a base wizard action to support simple wizard pages. In general all wizard pages use the same form, but I am not sure if that has to be the case. There is one "slot" (attribute) on the session that all wizard pages use to store a form (the "session form"). When the user clicks the next button on a page, the handler is responsible for pulling the pieces of data that were submitted on that page and populating the corresponding fields on the session form. This way the form in session is build up with each page.