D
Dan
Much has been posted regarding the pre-population of a form in a
Struts MVC application (such as pre-populating a listbox or entry
fields on a form). Generally speaking, the solution is to create
"pre" actions (such as EditAccountAction) that perform db or other
setup activity that forward to a jsp rather than invoking a jsp
directly. For validation, it has been suggested that the "input"
property of the action that handles the submission (such as a
UpdateAccountAction) simply point to the EditAccountAction rather than
the jsp. This has the benefit of calling the setup code once again
upon validation errors.
However, if you want to display the SUBMITTED data upon a failed
validation (such as missing field values) rather than the values
retrieved from the database once again there must be someway to have
the EditAccountAction be smart enough to recognize that we are in a
validation situation rather than a first time access situation. In my
application, this would be necessary in order to prevent the account
fields from being over written each time with fresh data (whereby
wiping out what could be other valid entries by the user).
I should note that it is still necessary to have the input property to
the pre-action since there are drop down boxes that still need to be
built in this step.
Any suggestions or best practices?
Struts MVC application (such as pre-populating a listbox or entry
fields on a form). Generally speaking, the solution is to create
"pre" actions (such as EditAccountAction) that perform db or other
setup activity that forward to a jsp rather than invoking a jsp
directly. For validation, it has been suggested that the "input"
property of the action that handles the submission (such as a
UpdateAccountAction) simply point to the EditAccountAction rather than
the jsp. This has the benefit of calling the setup code once again
upon validation errors.
However, if you want to display the SUBMITTED data upon a failed
validation (such as missing field values) rather than the values
retrieved from the database once again there must be someway to have
the EditAccountAction be smart enough to recognize that we are in a
validation situation rather than a first time access situation. In my
application, this would be necessary in order to prevent the account
fields from being over written each time with fresh data (whereby
wiping out what could be other valid entries by the user).
I should note that it is still necessary to have the input property to
the pre-action since there are drop down boxes that still need to be
built in this step.
Any suggestions or best practices?