If this method returns true, these two table rows with components
in them will be displayed, otherwise they will disappear.
Of course, we need to add such a method to the Registration page class:
public boolean isPasswordNotSubmitted()
{
return userName == null;
}
I am afraid we'll need to close the browser window now to get rid of the session;
otherwise the previously stored password will prevent us from testing the new
functionality. Run the application, fill in the form, click on the check box, and if you
have entered some value for the password, two table rows with password fields in
them should disappear.
We now have a rather flexible interface, and we had to write very little code to
achieve what we wanted. One of the methods used to enable all this flexibility is the
form submission handler. But wait, we didn't create this entire page just to play with
it and see how it changes, right? The purpose was to register a new user. We still
need to write some code to process the registration, but where do we put this code if
the form submission handler was already used for a different purpose?
This is exactly the situation where Submit component becomes important.
Submit Component
Right now we are using a basic HTML control to submit the registration form, but it
takes very little effort to convert it into a Tapestry Submit component.
Pages:
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160