Neal Kaiser wrote:
> How does this work when they are registering for the first time, not
> editing. I can
> see that in EditRegistrationAction the token is set... but if they are
> registering
> for the first time where is the token set? It seems that it would fail when
> it hits
> the token check in SaveRegistrationAction, but I know it doesn't, so it must
> be set
> somewhere, right?
>
You will note that the "Register with the MailReader Demonstration Application"
link (on index.jsp) goes through "EditRegistration.do" as well, so that the
token gets saved even in this case. The "?action=Create" request parameter is
used to distinguish this from the editing case ("?action=Edit").
This is a design pattern that I like a lot -- use the same Action to initialize
the input form when you are creating a new record or when editing an existing
one, and use a request parameter to define which type of transaction is
occurring. You will also find that the "action" request parameter gets included
as a property of the form bean, and is passed in (as a hidden variable) on the
input form so that SaveRegistrationAction knows what to do as well.
Craig