It will simply allow
you to see what is happening in the page class.
Chapter 4
[ 115 ]
Run the application, proceed to the Registration page, enter some username,
password, and then click on the check box, agreeing to subscribe. The text box for
email should appear instead of the check box, exactly as we expected, which is
good news. But on the other hand, the username and both versions of password
disappeared, and gender reverted to the initial value. This shouldn't be a surprise
to you if you read the previous chapter attentively??”Tapestry doesn't remember
anything unless we explicitly ask it to do so. Fortunately, enabling persistence is very
easy, we only need to add the @Persist annotation to the properties that we want to
be remembered:
@Persist
private String userName;
@Persist
private String password;
private String password2;
@Persist
private String email;
@Persist
private Gender gender = Gender.FEMALE;
There is actually no need to persist the password as it is never redisplayed anyway;
however, having the password property persistent will become useful a bit later.
Now the page should work better, but the problem is that, after we have agreed to
subscribe, we have almost no way to see the original check box.
Pages:
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157